Wednesday, September 1, 2010

special crontab entries

I have a file I need to change perms on every time my system reboots - just because. While looking for a better way of checking the file's perms through as opposed to doing a perpetual scheduled "for and if" loop, I came across a neat cron (5) stub I'd really never noticed before:

Instead of the first five fields, one of eight special strings may
  appear:

    string         meaning
    ------         -------
    @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 * * * *".


Cool. Now all I need to do is have my script run on reboot (well, when cron restarts, but still).

No comments: