Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating a Cron entry

Status
Not open for further replies.

nkm

Programmer
May 27, 2001
45
US
Hi

what is the best possible way of automating a cron entry.
That is some pgm creating a cron entry rather than manually editing and creating a entry.

Are there some options with crontab command.

thanks!!
 
Hi,

you can use "crontab -e" which gives you a copy of the current crontab file. If you use "crontab -e username" the user's crontab file can be edited (supposing you have the rights to edit another user's crontab.

mrjazz [pc2]
 
You can do something like this :-
crontab -l > /tmp/origcron
echo "00 10 * * /usr/bin/ls -l > /tmp/list.log 2>&1 " >> /tmp/origcron
crontab /tmp/origcron

(just an example ls -l, you can call your program)
If you require running different jobs when required at different times , you can us the at command and specify when to run the job e.g.

at 5 pm
(run a script) /home/script.sh


HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top