Skip to content

Latest commit

 

History

History
40 lines (36 loc) · 1.12 KB

File metadata and controls

40 lines (36 loc) · 1.12 KB

Task scheduling in cron

Crontab file location

/etc/crontab

editor preference

Vi is the default editor to edit crontab file
To change it nano use the command bellow
$EDITOR=nano crontab -e

Parameters

  • crontab -l : display content of the cron file
  • crontab -e : edit the crontab file
  • crontab -r : remove
  • crontab -v : display the last time of crontab file edition

crontab file Syntax

* * * * * command_to_execute
*[1] *[2] *[3] *[4] *[5] command_to_execute
  • *[1] : minute (0 - 59)
  • *[2] : hour (0- 23)
  • *[3] : day of month (1-31)
  • *[4] : month (1-12)
  • *[5] : day (0-6) (sunday, monday, ...., saturday)

additinal (non - standard):

  • @yearly (non-standard)
  • @annually (non-standard)
  • @monthly (non-standard)
  • @weekly (non-standard)
  • @daily (non-standard)
  • @hourly (non-standard)
  • @reboot (non-standard) : after reboot

eg

0 0 * * 6 rm /home/manantsoa/tmp/*: remove temp file for user "manantsoa" At 00:00 on Saturday

Check here