Shutdown Qbittorrent when disk space is low? Script possibly?
Shutdown Qbittorrent when disk space is low? Script possibly?
Hey I'm looking for a way to auto shutdown Qbittorrent when the drive gets low on space before it runs out. I've been looking around by haven't found anything. I'm thinking it should simple be a script? A cron job maybe that checks and kill QB if the drive is getting low on space. I was hoping for something that can gracefully shutdown QB so I don't corrupt any of my current running torrents in the process.
Thanks
Thanks
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
I think that observing your HDD yourself and only downloading when you have enough space is a better way than to kill qBittorrent and (probably) corrupt your torrents.
Still, im not using Linux so if there is a script maybe someone else can respond to this.
Still, im not using Linux so if there is a script maybe someone else can respond to this.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
A better idea would be to pause all downloads.
I just had QBT crash because all the storage space was used up. I also lost the payload of whatever I was downloading...probably over 20 GB lost.
I just had QBT crash because all the storage space was used up. I also lost the payload of whatever I was downloading...probably over 20 GB lost.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Until libtorrent supports arbitrary drive space checking and pausing, it's probably not going to happen.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Is there a command line command that I can use to exit QB? If there is I should be able to write a bash script to accomplish this pretty easily.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Just like you would stop any other process using the process name, send it a SIGTERM signal.
will trigger a 'clean' shutdown
or
To just stop qbittorrent, this, however may leave some or all of the active tasks in a 'dirty' state, which will probably require a 'recheck' at next start up.
Code: Select all
killall qbittorrent
or
Code: Select all
killall qbittorrent -s SIGKILL
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
[quote="bjames88"]
Is there a command line command that I can use to exit QB? If there is I should be able to write a bash script to accomplish this pretty easily.
[/quote]
I am interested in your bash script.
Is there a command line command that I can use to exit QB? If there is I should be able to write a bash script to accomplish this pretty easily.
[/quote]
I am interested in your bash script.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Another option would be to look into folder quotas or partitions.
My main problem with partitions is they don't seem to be flexible, or I don't know enough.
I'd like the option to shrink/expand quotas/partitons...without risk to screwing something up.
My main problem with partitions is they don't seem to be flexible, or I don't know enough.
I'd like the option to shrink/expand quotas/partitons...without risk to screwing something up.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
[quote="snakyjake"]
[quote="bjames88"]
Is there a command line command that I can use to exit QB? If there is I should be able to write a bash script to accomplish this pretty easily.
[/quote]
I am interested in your bash script.
[/quote]
Allow me to get you started
Replace 'sda1' with your drive device name, set your minimum space (in GB) and run the script in a crontab.
[quote="bjames88"]
Is there a command line command that I can use to exit QB? If there is I should be able to write a bash script to accomplish this pretty easily.
[/quote]
I am interested in your bash script.
[/quote]
Allow me to get you started

Code: Select all
#! /bin/bash
declare -i REQUIRED
REQUIRED=10*1024*1024*1024
# set minimum space required (GB) and convert to bytes
FREESPC=`df | grep sda1 | awk '{print $4}'`
# get free drive space in Bytes
if (( $FREESPC < $REQUIRED)); then
echo "No Chance"
else
echo "No Problem "
fi
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Yes that script is pretty much what I was going to do. You got with the "dirty state" problem though. Exactly what I was hoping to avoid with a proper shutdown. Is there a setting to auto force check all incomplete torrents at every time Qbittorrent tarts?
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
As I said,
Send a SIGTERM (-15) rather than a SIGKILL (-9) and wait for all processes to stop before shutting the machine down, if that is what you are doing.
Send a SIGTERM (-15) rather than a SIGKILL (-9) and wait for all processes to stop before shutting the machine down, if that is what you are doing.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
OK thought you were saying that I would still get dirty torrent shutdowns even using the SIGTERM. I guess I'll just have to give it a try and see what happens. Thanks.