Show pageOld revisionsBacklinksODT exportBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====Overview==== Crontab servers for jobs scheduling. In a nutshell, administrators put script there which they want to be executed at specific time or in specific frequency. As such crontab is suitable for: * Backup * Housekeeping * Archiving * Monitoring =====Configuration==== Configuration of crontab is fairly simply if we remember couple things. First let's check the syntax: <sxh bash> * * * * * command to be executed - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +------- month (1 - 12) | | +--------- day of month (1 - 31) | +----------- hour (0 - 23) +------------- min (0 - 59) </sxh> Having seen that, a job in crontab will look as follows: ===Example=== <sxh bash> 30 18 * * * rm /tmp/* >> /root/clean.log </sxh> This job, will execute each day at 18:30 and will delete everything in the temporary directory, and will write the log in /root/clean.log In order to create such a job, we have to execute the following: <sxh bash> [root@mysqlmaster ~]# crontab -e <- "e" - stands for Edit no crontab for root - using an empty one ~ 30 18 * * * rm /tmp/* >> /root/clean.log :wq </sxh> To list all the jobs, we can issue the following command: <sxh bash> [root@mysqlmaster ~]# crontab -l 30 18 * * * rm /tmp/* >> /root/clean.log [root@mysqlmaster ~]# </sxh> **Crontab configurations are per user, so each user has his own crontab, be sure that your user has the correct permissions to the the job** linux_maintenance_crontab.txt Last modified: 2019/10/18 20:04by 127.0.0.1