Crontab

Crontab is a file containing instructions for the cron daemon. It is a job scheduler where you add commands to be executed at defined periods.

Edit existing crontab file, or make new one if it doesn’t exist:

crontab -e

List of cronjobs , display crontab file contents:

crontab -l

Reload crontab:

service cron reload

(not necessary since the system will check periodically for crontab changes and apply them)

Removes the crontab file:

crontab -r

Time format in crontab

*****command
min (0-59)hour (0-23)day of the month (1-31)month (1-12)day of the week (0-6)
Sunday = 0

* is a wildcard, meaning any value from the given range

/ adds a step value

*/5 * * * *

This will be executed every 5 minutes.

0 18 * * 1-3

This will be executed at 18:00h on every day of the week from Monday to Wednesday.

Leave a Comment

Tested on Ubuntu & Pop OS