RSS

Tag Archives: crontab

yum install cronjob

Cron is a daemon that can be used to schedule the execution of recurring tasks according to a combination of the time, day of the month, month, day of the week, and week.

Install crond/crontab on linux:

# yum install vixie-cron crontabs
# /sbin/chkconfig crond on
# /sbin/service crond start

set default editor for crontab:
# export EDITOR=/usr/bin/nano

Setup crontab:
# crontab -e
1 2 3 4 5 /path/to/command arg1 arg2

Where,

* 1: Minute (0-59)
* 2: Hours (0-23)
* 3: Day (0-31)
* 4: Month (0-12 [12 == December])
* 5: Day of the week(0-7 [7 or 0 == sunday])
* /path/to/command – Script or command name to schedule

* * * * * command to be executed
– – – – –
| | | | |
| | | | —– Day of week (0 – 7) (Sunday=0 or 7)
| | | ——- Month (1 – 12)
| | ——— Day of month (1 – 31)
| ———– Hour (0 – 23)
————- Minute (0 – 59)

Sample:

* * * * * env php -q /var/www/html/cron.php

How to run cronjobs per second?

🙂

Advertisements
 

Tags: , , , , ,

Setting CronJobs

This is the pattern for cronjob setting on linux server:

Minute Hour Day-of-Month  Month-of-Year  Day-of-Week   Command

0 0 * * * D:/xampp/php -q D:/xampp/htdocs/dolfin/periodic/cmd.php
(every day)

*/10 * * * * D:/xampp/php -q D:/xampp/htdocs/dolfin/periodic/notifies.php
(every 10 mins)

* * * * * echo “This is an example of cron command”
(execute after every minute)

0 18 * * * sh /home/user1/take_backup
(take_backup at 6:00 PM every day)

10,30,50 9-18 * * 1-6 cp /home/user1/display
(every day from MON to SAT display execute every 20 mins from 9:00 AM to 6:00 PM)

 
Leave a comment

Posted by on March 20, 2008 in Uncategorized

 

Tags: , , , , ,