DISCLAIMER : Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility.If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.


Showing posts with label cron. Show all posts
Showing posts with label cron. Show all posts

Working with Crontab


Crontab is the scheduler program used ina unix servers.
Each user can have their own crontab, and though these are files in /var/spool/cron , they are not intended to be edited directly.

If  the  cron.allow  file  exists,  then you must be listed therein in order to be allowed to use this command. 
If the cron.allow file does not exist but the cron.deny file does exist, then you must not be listed in the cron.deny file in order to use this command. 
If  neither  of  these files exists, only the super user will be allowed to use this command.

cronatb -l  --- To view the crontab
crontab -e --- To edit the crontab

MIN HOUR DOM MON DOW CMD /script/location/full/path 

minute 0 through 59

hour 0 through 23

day_of_month 1 through 31

month 1 through 12

weekday 0 through 6 for Sunday through Saturday

Example :
30 08 10 06 * /home/xyz/full-backup
  
  • 30 – 30th Minute
  • 08 – 08 AM
  • 10 – 10th Day
  • 06 – 6th Month (June)
  • * – Every day of the week

Editing crontab

#crontab –l

# crontab -l > crontab.current    ------backup crontab

#vi crontab.current---------Modify changes to backup file

# crontab crontab.current---------To re-enable crontab with modified changes