Tuesday, July 24, 2012

cron in ubuntu


How to write cron in ubuntu


cron is use to perform we repetable jobs which is done in system each and every second or minute
when we install ubuntu it will come defaultly
sudo yum install vixie-cron crontabs
#
chkconfig crond on
#/service crond start

for suppose you would like to perform a command like example each every minute then you can do like this
it is in the below format
minutes hours (date of month) (month) (day of the weak) command
16 9 * * * chmod -R 777 /var/managment/*

here in the above we had given as every morning at 9hours 16minutes on every day every month this command will be executed
for suppose you would like to perform it for every 10 minutes means here it will be like this


*/10 * * * * chmod -R 777 /var/managment/*

so here the will will be runned for every 10 minutes,
if would like to run for every minute means then do like this
* * * * * chmod -R 777 /var/managment/*

so here the command will be runned for every minute
To check the cron running in your system then type like this
#crontab -l

to restart the cron then
#service crontab restart

No comments:

Post a Comment