Page 1 of 1
Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Mon Aug 10, 2015 11:11 pm
by bjames88
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
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Tue Aug 11, 2015 1:59 pm
by Nemo
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.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Thu Aug 13, 2015 1:34 am
by snakyjake
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.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Fri Aug 14, 2015 10:55 am
by ciaobaby
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?
Posted: Sat Aug 22, 2015 4:17 am
by 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.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Sat Aug 22, 2015 1:21 pm
by ciaobaby
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.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Sat Aug 22, 2015 3:56 pm
by 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.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Sat Aug 22, 2015 3:59 pm
by snakyjake
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.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Sat Aug 22, 2015 8:27 pm
by ciaobaby
[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
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
Replace 'sda1' with your drive device name, set your minimum space (in GB) and run the script in a crontab.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Thu Aug 27, 2015 1:11 am
by bjames88
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?
Posted: Fri Aug 28, 2015 1:35 pm
by ciaobaby
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.
Re: Shutdown Qbittorrent when disk space is low? Script possibly?
Posted: Fri Aug 28, 2015 4:09 pm
by bjames88
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.