Search This Blog

Friday, June 18, 2010

schedule script in linux using crontab.

Example 1:
This Example will schedule a job on 12 april at 23:00 Pm on Monday.

run following command in Linux.

#crontab -e

You will get a editor in linux .

just enter following lines into it.
00 23 12 4 mon /usr/local/sbin/copyfile.sh



Explanation
Min Hour day month day (script to be executed)
00 23 12 4 mon /usr/local/sbin/copyfile.sh



You can use following command to see what jobs are scheduled in the machine.
crontab -l



At command:
You can use at command to execute the command only once. This is to avoid repetitive execution of command.Even if cron is capable of doing this but it is recommended to execute the command using at if it is supposed to run once .

Nice article over crontab.

http://www.thegeekstuff.com/2011/12/crontab-command/

Please Leave us with your comments and Queries/Suggestions.
I will try to reply asap.

No comments:

Post a Comment