I mentioned cron in the last post, but I think aside from that brief example, I’ve barely ever written about it.
There’s no real reason for that, except that I don’t use it very often and so as a result I don’t mention it. Hopefully the logic in that is clear. :roll:
It’s not too difficult to set up or understand though, and so the example I gave yesterday makes a good starting point. Here are those lines again.
00 * * * * /usr/bin/python /home/kmandla/.xplanet/download_clouds.py /home/kmandla/.xplanet/clouds_2048.jpg 00 23 * * * /usr/sbin/vbetool dpms off 30 06 * * * /usr/sbin/vbetool dpms on
You can edit crontab by entering
crontab -e (of all things) and your defined $EDITOR will take over.
The gist of cron — for me — is simply this: Those two first numbers are the time you want the action performed, listed in reverse.
So “00 23″ is actually 11 p.m., listed minutes first then hour. Every day at 11 p.m., that command is run. And “30 06″ is 6:30 a.m.
The “00” without a number, with only a splat next to it, means every hour on the hour. Like I mentioned yesterday, I don’t know exactly when the weather maps are updated, so once an hour is probably enough.
Everything I’ve shown there runs daily, but if I wanted a command run on a particular day of the month, I could list the day number next.
So it should follow that the next column is the month. And the last column? The day of the week, with Sunday as day 0.
That’s the long and short of it. You can tell cron to do whatever, whenever via crontab. After restarting cron for good measure, you should be set. So for one last example:
15 05 * * * 6 /usr/bin/yaourt -Syu
Every week at 5:15 a.m. on Saturday, a system-wide update.
If you need more details or if you have a huge slew of commands you want run at the same time check out the Arch wiki page for cron. Once again, the Arch wiki is the best resource around. …