I'm toying around with building an application to display messages on the screen on a desired intervals.
I want to use cron to achieve that and I am considering my options. The most naive approach would be to print the commands directly into crontab. Is that a bad idea?
No, it is not bad to have a long list in
crontab
.cron
executes in minutes at the shortest time frame so it is not in real time but you can also have your notices in real time (see below).As an alternative option you can also use
cron
to run 1 script that executes all your differentcrontab
lines you otherwise would have included in yourcrontab
where that file is executes or checks all the different options you want to get notices from. That would also be easier to maintain: if you need a new task you add it to your script and you can check if that job is flawed from the script itself (cron can be rather picky).Might I also suggest you also have a look at creating an
upstart
job. This would be more the Ubuntu way. This way you create adaemon
orservice
that you can start and stop from command linel. Plus it would make your notices real time instead of periodically.Use
gnome-schedule
It's intuitive, and it's easier to launch graphical applications from (doing that via
cron
requires some extra work) - just don't forget to mark the command as an X application one in the task configuration.Homepage: http://gnome-schedule.sourceforge.net/
Sample use: http://www.liberiangeek.net/2011/04/schedule-a-job-to-automatically-put-ubuntu-into-sleep-or-hibernation-mode/