homepage Welcome to WebmasterWorld Guest from 107.22.45.61
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

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




msg:909220
 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




msg:909221
 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




msg:909222
 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




msg:909223
 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




msg:909224
 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




msg:909225
 6:25 am on Oct 8, 2003 (gmt 0)

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

gutabo




msg:909226
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved