Friday, May 24, 2013

UNIX CRONTAB Commands

CRONTAB COMMANDS:
-----------------
crontab -l                 #Lists the contents of your current crontab file
crontab -e                 #Edits your current crontab file (when the file saved, the cron daemon is automatically refreshed.)
crontab -r                 #Removes your crontab file from the crontab directory
crontab -v                 #check crontab submission time
crontab mycronfile         #submit your crontab file to /var/spool/cron/crontabs directory

crontab file format:
minute    hour    day_of_month    month        weekday        command
0-59      0-23    1-31            1-12        0-6 Sun-Sat     shell command

* * * * * /bin/script.sh        #schedule a job to run every minute
0 1 15 * * /fullbackup          #1 am on the 15th of every month
0 0 * * 1-5 /usr/sbin/backup    #start the backup command at midnight, Mo - Fr
0,15,30,45 6-17 * * 1-5 /home/script1    #execute script1 every 15 minutes between 6AM and 5PM, Mo - Fr

No comments:

Post a Comment