Crontab Usage

Nov 15, 2017

Edit crontab file

$ crontab -e

The crontab file looks like this:

<minute> <hour> <day> <month> <week> <command>
- minute: 0~59
- hour: 0~23
- day: 1~31
- month: 1~12
- week: 0~7 (0 and 7 for Sunday)
- command: your command

Executed every 1 minute:

* * * * * echo "Hello World"

Executed every Saturday night at 02:00 :

00 02 * * 6 echo "Hello World"

Executed at 02:00 on the 1st and the 15th of every month:

00 02 1,15 * * echo "Hello World"

Check logs:

$ tailf  /var/spool/mail/root
$ tailf /var/log/cron