homepage Welcome to WebmasterWorld Guest from 54.145.183.190
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Cron jobs?
Help please!
gutabo

10+ Year Member



 
Msg#: 799 posted 12:55 am on Oct 7, 2003 (gmt 0)

I've tried to set up a Cron Job with no success. Mind helping me? I need to zip my log file on a daily basis(naming it with the date), and remove it inmediately after.(it grows 90MB/day)

Help please!

 

Josk

10+ Year Member



 
Msg#: 799 posted 9:59 am on Oct 7, 2003 (gmt 0)

Do you have any other details...? i.e, what have you put in crontab, what script and script type are you using..? Do you have the file locations correct...? etc, etc...

zoran

10+ Year Member



 
Msg#: 799 posted 11:41 am on Oct 7, 2003 (gmt 0)

Try something like

"minute hour dayOfMonth month dayOfWeek command"

in your crontab file with your preferred hour/time and a "command" like:

/bin/tar -czf /backupdir/`date +\%Y-\%m-\%d-\%H-\%M`.tar.gz /path/to/file

kenta

10+ Year Member



 
Msg#: 799 posted 5:30 pm on Oct 7, 2003 (gmt 0)

I usually find these things helpful:.

I put all the commands in shell scripts/perlscripts. Seems to make things easier for me to look at, then I have the command handy if I need to execute it outside of cron

I make a text file with all my cron info i.e.:

#Min Hour Day DayMonth DayWeek
* 1 * * * /home/kenta/backup.sh
5 * * * * /home/kenta/popmail.pl >/dev/null

Then dump it into my crontab by typing "crontab filename.txt" and view it by typing "crontab -l" Making changes to filename.txt and doing the command again with just the filename overwrites the current crontab.

I assume you may already know the syntax of what the *'s and #'s mean in cron... If not, let us know.

gutabo

10+ Year Member



 
Msg#: 799 posted 7:03 pm on Oct 7, 2003 (gmt 0)

Sorry, we're using a FreeBSD Unix server. Anyway, the only thing I'm missing is the "comand" part, cause we need to ZIP the log file and remove the access_log file inmediately afterwards. We want to make this procedure daily.

PLEASE HELP ME!</unix n00b>

zoran

10+ Year Member



 
Msg#: 799 posted 6:25 am on Oct 8, 2003 (gmt 0)

Sorry, no experience with FreeBSD. You may want to try
[unixreview.com...]

gutabo

10+ Year Member



 
Msg#: 799 posted 1:13 am on Oct 10, 2003 (gmt 0)

Ok, I digged and found a very useful(and easy to use) tool: savelogs. It gzips your logs and removes them leaving a 0KB file behind if you want(just what I wanted). And thanks to your help, I configured a cron job. It was something like this:

5 0 * * * /usr/local/bin/savelogs --config=/path/to/savelogs.conf

Thank you!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved