Page 1 of 1

ReadyNAS Stop/Start qBittorrent from command line & schedule Cron job

Posted: Tue Sep 23, 2014 5:31 pm
by amc_oldsarge
Looking for some help with qBittorrent on a ReadyNAS.

I want to create a cron job to stop and start qBittorrent at certain times of the day.  Throttling down is not an option (even zero).  I've tried to stop qbittorrent using: qbittorrent-nox stop  But it continues to run. (still appears in top)

What is the best way to stop qBittorrent via command line?  And has anyone managed qBittorrent via a cron job (if so, any hints??)?

Thanks!

Re: ReadyNAS Stop/Start qBittorrent from command line & schedule Cron job

Posted: Tue Sep 23, 2014 6:27 pm
by ciaobaby
[quote="amc_oldsarge"]
What is the best way to stop qBittorrent via command line? [/quote]
Use the web UI as there IS no 'command line'.

Re: ReadyNAS Stop/Start qBittorrent from command line & schedule Cron job

Posted: Tue Sep 23, 2014 7:00 pm
by amc_oldsarge
I'm not able to schedule anything via the WebUI, only turn the app on and off.

I want this to occur seamlessly in the background, without my actual intervention.

I can SSH into the server and stop/start apache2 or MySQL or OwnCloud, no reason I can't do the same with qBittorrent.  Just need help (command to stop/start process) doing it via a SSH session (ie. "Command Line").

Thanks!

Re: ReadyNAS Stop/Start qBittorrent from command line & schedule Cron job

Posted: Tue Sep 23, 2014 7:29 pm
by ciaobaby
no reason I can't do the same with qBittorrent
There is a reason, .... .... qBitTorrent doesn't HAVE a command line interpreter

Re: ReadyNAS Stop/Start qBittorrent from command line & schedule Cron job

Posted: Tue Sep 23, 2014 7:38 pm
by sledgehammer_999
If you send SIGKILL to the process it should catch it and terminate gracefully.

Re: ReadyNAS Stop/Start qBittorrent from command line & schedule Cron job

Posted: Thu Sep 25, 2014 7:40 pm
by sledgehammer_999
Um I just read the code. You should issue either SIGINT or SIGTERM to exit cleanly.

Re: ReadyNAS Stop/Start qBittorrent from command line & schedule Cron job

Posted: Wed Oct 01, 2014 4:46 pm
by amc_oldsarge
I just wanted to follow up on this issue as I have found a solution to the issue.  Hopefully someone will find it helpful.

You can in fact stop and start qBittorrent via terminal, ssh, or a cron job on a ReadyNAS.

I edited my crontab file via ssh using the following command:  crontab -e

I inserted the following text at the bottom of the file:

#############################################
# Run Monday through Friday from 0000 to 1600
0  0 * * 1-5 systemctl start fvapp-qbittorrentr6
0 16 * * 1-5 systemctl stop fvapp-qbittorrentr6

# Run Saturday and Sunday from 0200 to 0800
0  2 * * 0,6 systemctl start fvapp-qbittorrentr6
0  8 * * 0,6 systemctl stop fvapp-qbittorrentr6
#############################################

This stops qBittorrent automatically and restarts it when my family is using the internet (mostly). Throttling back wasn't enough (even Zero).

You can also just run "systemctl stop fvapp-qbittorrentr6" from ssh if you want to stop qBittorrent.

Running "systemctl status fvapp-qbittorrentr6" will give you some basic info about the service.

Thanks for those who help me find the solution.

Re: ReadyNAS Stop/Start qBittorrent from command line & schedule Cron job

Posted: Wed Nov 20, 2019 5:10 pm
by virtojedri
Sorry for necroposting.

Recent versions of qBittorrent-nox have a REST api. Meaning that you can send HTTP requests of anything that you can do in the WebUI. For example, to stop all torrents you can add this entry in crontab:

Code: Select all

0  2 * * 0,6 curl 'http://raspberrypi:8080/api/v2/torrents/pause' --data 'hashes=all'
TIPS:
- You will have to change raspberrypi with your IP. If is the same machine use 127.0.0.1.
- Change the 8080 with the port that your qBittorrent is using for its webui
- Enable 'Bypass authentication for clients on localhost' to allow the same machine, or 'Bypass authentication for clients in whitelisted IP subnets' with the ip range that you want to allow. If you don't do that, the request will fail unless you include the cookie in the request.