User Tools

Site Tools


cs:crontab
Return to Home page

Crontab

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 day
  • 30 3 1 * * : The command is executed ad 3:30am every first day of every month

If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/crontab?do=
/web/htdocs/www.skenz.it/home/data/pages/cs/crontab.txt · Last modified: 2024/04/08 22:34 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki
Privacy Policy