Skip to content

crontab | Cheatsheet

Crontab stands for "cron table". It allows to use job scheduler, which is known as cron to execute tasks.

Crontab is also the name of the program, which is used to edit that schedule. It is driven by a crontab file, a config file that indicates shell commands to run periodically for the specific schedule.


Execute a cronjobb manually

eval "$(crontab -l | sed -n '5p' | tr -s ' ' | cut -d' ' -f 6-)"
crontab -l
Template that can be used in cronie
##########################################################################
###
#### - wuseman help
#### -------------------------------------------------------------------
#### * * * * * command to be executed
#### - - - - -
#### | | | | |
#### | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
#### | | | ------- Month (1 - 12)
#### | | --------- Day of month (1 - 31)
#### | ----------- Hour (0 - 23)
#### ------------- Minute (0 - 59)
###
##########################################################################
###
####  Special 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 * * * *”.
###
##########################################################################
MAILTO="wuseman@nr1.nu"

##########################################################################
###
#### - Disable email output for everyone
###
#### 0 3 * * * /root/backup.sh >/dev/null 2>&1
###
##########################################################################

##########################################################################
###
####  To mail output to particular email account, lets say wuseman@nr1.nu 
####  you need to define MAILTO variable as follows:
#### --------------------------------------------------------------------
####  MAILTO="wuseman@nr1.nu"
####  0 3 * * * /root/backup.sh >/dev/null 2>&1
###
##########################################################################