Crontab is a Unix utility that allows users to schedule commands or scripts to run periodically at fixed times, dates, or intervals. It stands for “cron table,” where “cron” is the name of the Unix system daemon responsible for executing scheduled tasks.
#man crontab (for more details)
Crontab has 6 fields:
******
*———–>(0-59)-min
*———–>(0-23)-hour
*———–>(1-31)-day of month
*———–>(1-12)-month of year
*———–>(0-6)-Day of week
last———>script name
To list the crontab entries:
#crontab -l
To edit the crontab
#crontab -e
Here example for every five mins
*/5 * * * * /root/script.sh
Need to check crontab running or not?
#cat /var/log/cron
(check last log messange)
You can also use specific values or ranges for each field. For example:
0 0 * * *would run the command at midnight every day.*/5 * * * *would run the command every 5 minutes.30 2 * * 1would run the command at 2:30 AM every Monday.
Leave a comment