Cron is a tool for time based job scheduling - found in most of Unix based operating systems. Although it was developed long time ago, its simplicity & effectiveness is remarkable.
Any script or command which is to be executed in some time interval, can be set with Cron.
/home/username/venv/bin/python /home/username/venv/project/script.py
crontab -e
m h dom mon dow
format, which means minute hour dayofmonth month dayofweek command
. Detail instruction & example are also included in the file itself0 12 * * * /home/username/venv/bin/python /home/username/venv/project/script.py
*
. Then only the non *
fields will be considered, as here I have ignored the dom, mon, dow fields, so the Cron will run dailyCtrl+O
& Ctrl+X
to saveEnsure there are no \n
character in the entry line, else parsing error will be thrown while saving
dameon
will check the entries in its own, so not need to restart it after entry/var/spool/cron/crontabs/username
syslog
. We can search Cron logs by username
cat /var/log/syslog | grep "CRON" | grep "username"