A linux demon useful to schedule tasks (i.e., execute some scripts).
To edit contab
file:
crontab -e
To list the scheduled tasks:
crontab -l
Example:
0 3 * * * /home/user/crontab_backup.sh > /dev/null 2> /home/user/crontab_backup.error
this command executes the script crontab_backup.sh
that is in the directory /home/user
every day at 3am. The output of the script is discharged (i.e., stdout
is redirected to /dev/null
), while errors (writes on stderr
) are redirected in the crontab_backup.error
located in the directory /home/user
.
Examples regarding the scheduling:
0 3 * * 2,4,6
: The command is executed at 3am the days of the week number with numbers 2, 4 and 6 (numbers are: 0-Sunday, 1-Monday, 2-Tuesday, 3-Wednesday, 4-Thursday, 5-Friday, 6-Saturday)30 3 * * *
: The command is executed at 3:30am every day30 3 1 * *
: The command is executed ad 3:30am every first day of every month