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

Other platforms, generic questions.

Moderators: Moderator, Global Moderator

Post Reply
amc_oldsarge
Newbie
Newbie
Posts: 4
Joined: Tue Sep 23, 2014 5:14 pm

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

Post by amc_oldsarge » Tue Sep 23, 2014 5:31 pm

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!

User avatar
ciaobaby
Forum addict
Forum addict
Posts: 2771
Joined: Sat May 18, 2013 4:08 pm

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

Post by ciaobaby » Tue Sep 23, 2014 6:27 pm

[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'.
Smarter than the av-er-age bear, Boo Boo.

http://qbforums.shiki.hu/index.php/topic,3084.0.html

amc_oldsarge
Newbie
Newbie
Posts: 4
Joined: Tue Sep 23, 2014 5:14 pm

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

Post by amc_oldsarge » Tue Sep 23, 2014 7:00 pm

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!

User avatar
ciaobaby
Forum addict
Forum addict
Posts: 2771
Joined: Sat May 18, 2013 4:08 pm

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

Post by ciaobaby » Tue Sep 23, 2014 7:29 pm

no reason I can't do the same with qBittorrent
There is a reason, .... .... qBitTorrent doesn't HAVE a command line interpreter
Smarter than the av-er-age bear, Boo Boo.

http://qbforums.shiki.hu/index.php/topic,3084.0.html

sledgehammer_999
Administrator
Administrator
Posts: 2408
Joined: Sun Jan 23, 2011 1:17 pm

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

Post by sledgehammer_999 » Tue Sep 23, 2014 7:38 pm

If you send SIGKILL to the process it should catch it and terminate gracefully.

sledgehammer_999
Administrator
Administrator
Posts: 2408
Joined: Sun Jan 23, 2011 1:17 pm

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

Post by sledgehammer_999 » Thu Sep 25, 2014 7:40 pm

Um I just read the code. You should issue either SIGINT or SIGTERM to exit cleanly.

amc_oldsarge
Newbie
Newbie
Posts: 4
Joined: Tue Sep 23, 2014 5:14 pm

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

Post by amc_oldsarge » Wed Oct 01, 2014 4:46 pm

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.

virtojedri
Newbie
Newbie
Posts: 1
Joined: Wed Nov 20, 2019 5:03 pm

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

Post by virtojedri » Wed Nov 20, 2019 5:10 pm

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.

Post Reply