crontab -e # to edit (then 'i': insert, ':wq!': save and quit)
10 * * * * /bin/sh backup.sh # every hour at 10"
0 */4 * * * /bin/sh backup.sh # every 4 hours at 0"
0 9-17 * * * /bin/sh backup.sh # every hour at 0" between 9 and 17
0 2 * * * /bin/sh backup.sh # daily at 2am
0 0 * * MON /bin/sh backup.sh # every Monday at 0am
0 0 * * 1-5 /bin/sh backup.sh # daily from Monday to Friday at 0am
0 0 * * 0 /bin/sh backup.sh # weekly on Sunday
0 0 1 * * /bin/sh backup.sh # monthly (1rst day at 0am)
0 0 1 */3 * /bin/sh backup.sh # every quarter (1rst day at 0am)
0 0 1 1 * /bin/sh backup.sh # yearly (01/01)
# ┌───────── 0-59 Minute # NOTES: Escape %s in command like \%
# │ ┌─────── 0-23 Hour # Blackhole Output: stdout: >/dev/null
# │ │ ┌───── 1-31 Day of Month # Blackhole Output: stderr: 2>/dev/null
# │ │ │ ┌─── 1-12 Month # Blackhole Output: Both: 2>&1 >/dev/null
# │ │ │ │ ┌─ 0-6 Sun-Sat ################################################
# * * * * * command
## EXAMPLES ####################################################################
1 * * * * echo "Runs hourly at first minute" >/dev/null
30 23 * * * echo "Runs daily at 23:30 (11:30 PM)" >/dev/null
0 0 1 * * echo "Runs monthly on day 1 at midnight" >/dev/null
45 12 * 2 * echo "Runs at 12:45 everyday during Month:2 (Feb)" >/dev/null
15 0 * * 6 echo "Runs at 00:15 on 6th weekday (Sat)" >/dev/null
cronjobs