Cron

Category:

Crontab commands

Edit user’s crontab

crontab -e

List user’s crontab

crontab -l

Delete user’s crontab

crontab -r

Crontab examples

On every minute

* * * * * /scripts/foo.sh

On every 5 minutes

*/5 * * * * /scripts/foo.sh

At midnight on first day of every month

0 0 1 * * /scripts/foo.sh

On every 30 seconds

* * * * * /scripts/foo.sh
* * * * * sleep 30; /scripts/foo.sh

At night on last day of every month

0 3 28-31 * * test $(date -d tomorrow +%d) -eq 1 && /scripts/foo.sh