Friday, August 5, 2011

CronTab Usage

Actual Syntax Of CronTab

* * * * * 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)


 Task: Run the file daily at 11:30pm

30---> Minutes
23---> Hours
*  ---> DayOfthemonth
*  ---> Month
*  ---> Week

will call the "sample.sh" file at every day 11:30pm

To enter new cron Job,  type in terminal : crontab -e

30 23 * * * /home/sample.sh        


The above specified cron job will on every day

we have restart the crond service to get it effective.

  • # /etc/init.d/crond start
  • # /etc/init.d/crond stop
  • # /etc/init.d/crond restart

To See List Of CronJobs:

  •  # crontab -l

To Edit CronJob:  #crontab -e

After Edit you have to restart the "crond"  service to make it effective.

No comments:

Post a Comment