To create cron jobs in Linux:
Just remember the following syntax
.—————- minute (0 – 59)
| .————- hour (0 – 23)
| | .———- day of month (1 – 31)
| | | .——- month (1 – 12) OR jan,feb,mar,apr …
| | | | .—- day of week (0 – 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
| | | | |
* * * * * user-name command to be executed
1. run crontab -e
and append your command/tasks as following
i.e.
* * * * * python /etc/script.py
2. can also edit crontact file directly
vim /etc/crontab and append your tasks
i.e.
* * * * * root touch filename
To view view cron jobs in Linux:
$ crontab -l
$ cat /etc/crontab