Pages

Bài đăng phổ biến

Thursday, December 8, 2011

Cron job on linux (crontab)

Crontab have 5 star, The stars represent different date parts in the following order:

1. every minutes
2. every hours
3. every day
4. every month
5. every week

Execute every minute

If you leave the star, or asterisk, it means every. Maybe that's a bit unclear. Let's use the the previous example again:
* * * * * /bin/execute/this/script.sh


They are all still asterisks! So this means execute /bin/execute/this/script.sh:
  1. every minute
  2. of every hour
  3. of every day of the month
  4. of every month
  5. and every day in the week. (0: Sunday 1: Monday,..6:Saturday)
In short: This script is being executed every minute. Without exception.

Execute all day

So if you want to schedule the script to Monday till Sunday at 12 AM, you would need the following cronjob:
0 0 * * * /bin/execute/this/script.sh
Linux Guide

No comments:

Post a Comment

Thanks for your join,we will be reply to you asap.