Home > linux > Neat crontab tricks

Neat crontab tricks

December 26th, 2009 Leave a comment Go to comments

There are several special entries, some which are just shortcuts, that you can use instead of specifying the full cron entry. The most useful of these is probably @reboot which allows you to run a command each time the computer gets reboot.

You can alert yourself when server is back online after a reboot. Also becomes useful if you want to run certain services or commands at start up.The complete list of special entries are:

Entry Description Equivalent To
@reboot Run once, at startup. None
@yearly Run once a year 0 0 1 1 *
@annually (same as @yearly) 0 0 1 1 *
@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) 0 0 * * *
@hourly Run once an hour 0 * * * *

The most useful again is @reboot. Use it to notify you when your server gets rebooted!

Categories: linux Tags:
  1. No comments yet.
  1. No trackbacks yet.