I run a seed-box like local machine with Ubuntu 14.04LTS setup with multi-user rtorrent/rutorrent.
I installed that through a script that also installed crontab entries for each user so rtorrent & irrsi would start automatically at boot.
Load is too high (especially on the network) if all users rtorrent/irrsi are running at the same time. So I have started to
su - user
password
crontab -e
& then comment these rtorrent/irrsi lines out for users A-D & uncomment them for users E-H.
Later at night, when I return from work, I do the same but uncomment these lines for users A-D & comment these lines out for users E-H.
All this editing has made me starting to wonder if there wouldn't be an easier way to accomplish this... Would there be a way of creating a script that adds a # in front of all the lines in the crontab of all the users I specify. And then maybe a second script to remove that # (if present).
EDIT: each users' crontab contains only these 2 lines.
@reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent
*/5 * * * * /usr/local/bin/rtcheck irssi rtorrent
When I don't want them to be run at reboot or later, when cron finds them not running, I just comment out these lines so they look like this:
#@reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent
#*/5 * * * * /usr/local/bin/rtcheck irssi rtorrent
making it effectively neither irssi nor rtorrent start a boot nor get started later when cron finds them not running.
crontab
entries ? (Please add them a the end of yr original post.)crontab
and not root's ?/etc/crontab
No need to mess with every users crontab when you can use that one and include a username. 1 place to store them. 1 place to edit them. And you reaaaaaaaaally should check the user name in a script and not edit crontabs.