News and tips from the dark basements

cron timing shortcuts

I had occasion to discover this recently–I’ve used cron for years, but never knew this!

You can shortcut some of the times you might commonly use in your crontab in Debian (and, most-likely, in other distros). For instance:

@yearly

@annually

@monthly

@weekly

@daily

@midnight

@hourly

All of these is equivalent to a “standard” time: @hourly, for instance, is the same as saying “0 * * * *”, et cetera.

That’s cool as heck, of course, but the one that really wowed me was this one: @reboot. This will let a non-privileged account run something at startup, WITHOUT it having to be in /etc/init.d! Use it like so: