Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2011/02/10

Named Times in Crontab

I first dealt with crontab in the late 1990s, and I still run many of those same crontabs. I mean, same program, same times. So, my understanding of that tool is very tied to that time.

Of course, very little changes in technology over 15 years. </sarcasm> So I recently looked through man 5 crontab and found that there are special strings for certain common times.
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".

Some of these come with variable utility. What are you doing on a system that's @yearly? Sending "Happy New Year!" to everybody you know? There's much here that strikes me as better done connecting to a calendar. In fact, I'm hatching an idea of setting up a calendar in Google Calendar to do that sort of wide-ranging crontabby or batchy stuff. If something runs less common than weekly, it doesn't get into my crontabs.

Except...

I'm really drawn to the @reboot string. For my work setup, I have FUSE mounts to a great number of machines (which I really use) and a specific line to configure the line-in to go directly to line-out so I can route my Windows box and Android phone through my Linux box to my headphones. I've put those commands into my crontab at @reboot.