The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

*nix: Cron shortcuts @daily, @weekly, @monthly, … (via: Cron and Crontab usage and examples)

Posted by jpluimers on 2015/01/16

Even if you think you are familiar with something, it pays to keep your knowledge current.

I’ve been always struggling with the crontab syntax. It’s flexible, but for most cases overly complex, for instance I still thought I needed “0 0 * * 0” to run something weekly, which I needed.

So I am pretty sure there were no @monthly or @weekly in crontab last century.

Not so any more, and if I’d had the crontab documentation more often, I had known about the crontab shortcuts @reboot, @yearly, @annually, @monthly, @weekly, @daily, @midnight and @hourly many years ago:


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 * * * *".

Funny thing: even the openSUSE cron docs don’t show these, but it looks like it is from the “crontab.5.diff” dated early this century (:

–jeroen

via:

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.