Welcome to WebmasterWorld Guest from 54.144.107.83

Forum Moderators: bakedjake

Message Too Old, No Replies

Cron jobs?

Help please!

     
12:55 am on Oct 7, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 17, 2001
posts:126
votes: 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!

9:59 am on Oct 7, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 4, 2000
posts:446
votes: 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...
11:41 am on Oct 7, 2003 (gmt 0)

New User

10+ Year Member

joined:Oct 3, 2003
posts:10
votes: 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

5:30 pm on Oct 7, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 12, 2002
posts:43
votes: 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.

7:03 pm on Oct 7, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 17, 2001
posts:126
votes: 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>

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

New User

10+ Year Member

joined:Oct 3, 2003
posts:10
votes: 0


Sorry, no experience with FreeBSD. You may want to try
[unixreview.com...]
1:13 am on Oct 10, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 17, 2001
posts:126
votes: 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!