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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting up cron

Status
Not open for further replies.

cleansedbb

Technical User
Feb 11, 2002
95
US
I've never set up a cron or script. how would I do the following

I have
/var//var//var//var/
in each I have a log.html which stores visitors. I want to archive it daily like
zip /var/ log1.zip and then next day do log2.zip etc.

also I would like to change a file to .log so I can view it through a log complier program. so maybe
cp /var/ log1.log

after zipping I will want to remove the file and put a clean one up.
so maybe
rm /var/touch /var/ or maybe
cp /var/backup/log.html /var/
 
Hi,

If its redhat, the cron mechanics are very easy. For a daily run you only need to put your script in the /etc/cron.daily directory. The main crontab calls every script in that directory using the 'run-parts' routine. The script itself would be indentical to one run directly from the command prompt - although you should make sure that you use full paths, etc. This assumes that you have the cron daemon active which you would almost certainly have by default.

If its not redhat, then you probably just need the additional step of creating the crontab entry -->
As for the actual code ..... that's another subject really.

Hope this helps
 
ok, do you have a site on writing the code?
it is redhat 7.2
 
If you have KDE installed, you can also take a peek at kcron, I find it pretty useful when I am in a hurry to test or setup something as a cron job.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top