Scheduled Tasks / Stopping program question

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
User avatar
felemur
Level 5
Level 5
Posts: 535
Joined: Sun Sep 20, 2015 2:22 pm
Location: In the middle of 1000's of acres of corn & soy fields in a house full of cats.

Scheduled Tasks / Stopping program question

Post by felemur »

I'm a fairly recent convert from Windows 7, and not very Linux literate yet.

I have limited monthly internet usage before extra fees kick in, except between 2am and 9am, when my use is unlimited and free. Because of this, when I was using Windows 7, I had the Task Scheduler start qbittorrent at 2am and run for 7 hours, stopping it at 9am. It worked great, and I never had to worry about forgetting to turn it off.

Now with my Linux Mint Cinnamon, I have figured out to use gnome-schedule to have qbittorrent start at 2am (seemed easier than cron). Problem is, there is no time limit setting like Windows Task Scheduler to make sure it shuts off at 9am. So...

I was thinking, maybe I could schedule another recurring event every day at 9am that shuts down qbittorrent.

If this is possible, would someone let me know what I would put in the command line of that event to make it shut down qbittorrent. The command line I put in to start the program is: /usr/bin/qbittorrent.

Thanks. -david
Shryp
Level 2
Level 2
Posts: 69
Joined: Tue Sep 08, 2015 2:13 am

Re: Scheduled Tasks / Stopping program question

Post by Shryp »

I use deluge, but deluge and qbittorrent both have built in schedulers. Why don't you just use the built in options of your client to disable sharing during other times? You should be able to set the upload and download speeds to 0 for other times and then the program will keep running, but not sending data.

You could probably do a command something like:

killall qbittorent

I am not sure if that will cause qbittorent to shut down cleanly or not. You can mess around sending different signals as well. If it will respond correctly, you could shut it down that way.

This MIGHT shut it down more cleanly:

killall -s SIGQUIT qbittorrent


http://www.thegeekstuff.com/2009/12/4-w ... ill-xkill/
https://www.ibm.com/developerworks/comm ... s7?lang=en

Someone with more experience might be able to give you better options.
User avatar
felemur
Level 5
Level 5
Posts: 535
Joined: Sun Sep 20, 2015 2:22 pm
Location: In the middle of 1000's of acres of corn & soy fields in a house full of cats.

Re: Scheduled Tasks / Stopping program question

Post by felemur »

Thanks for that. I hadn't noticed that qbittorrent had a scheduler built in. I tried it, and it works. It doesn't allow going to 0 KiB/S for the off times, but it does go down to 1 KiB/s, which is good enough.

Since that works for me, I won't bother with messing around with trying to kill the program, as (at least in Windows) if it doesn't shut down cleanly, it can waste a lot of time "Checking resume data" on the next startup - and on big files, that can take a lot of time with a slow external HD using USB 2.0

So, thanks again - you solved my problem, and I appreciate the quick help. -david
Post Reply

Return to “Newbie Questions”