Crontab


CRON Cheat sheet - secret sauce

Five field system

Needs a user only in system cron files ( /etc/cron.d/local )

 # * * * * * [user] command to execute
 # │ │ │ │ │
 # │ │ │ │ │
 # │ │ │ │ └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
 # │ │ │ └────────── month (1 - 12)
 # │ │ └─────────────── day of month (1 - 31)
 # │ └──────────────────── hour (0 - 23)
 # └───────────────────────── min (0 - 59)

To test a system cron file save - then:

$ systemctl restart cron
$ systemctl status cron

Errors will show up. (if editing a user cronfile via crontab -e it is tested at save.

Or in place of the 5 fields

Entry Description Equivalent to
@yearly (or @annually) Run once a year at midnight of January 1 0 0 1 1 *
@monthly Run once a month at midnight of the first day of the month 0 0 1 * *
@weekly Run once a week at midnight on Sunday 0 0 * * 0
@daily Run once a day at midnight 0 0 * * *
@hourly Run once an hour at the beginning of the hour 0 * * * *
@reboot Run at startup @reboot

Notes

/etc/cron.d is scanned every minute for changes - so if you make a change to run at the next minute it will fail - push it to two minutes.

Disclaimer

This information may have errors; It is not permissible to be read by anyone who has ever met a lawyer.
Use is confined to Engineers with more than 370 course hours of electronic engineering for theoretical studies.
ph +1(785) 841-3089 Email inform@xtronics.com

(C) Copyright 1994-2017, Transtronics, Inc. All rights reserved
Transtronics® is a registered trademark of Transtronics, Inc.
All trademarks are the property of their respective owners.