Web Hosting Talk







View Full Version : Help with small sh/cron script


ReliableServers
10-24-2001, 01:47 PM
Hi everyone. I use webalizer for stats on my domains. I currently have each one listed in the cronjob. I tried to setup a sh script that would run one then run the next etc...putting each on its own line. What happends is some of them loop and dont exit to the next webalizer to be run. Any ideas?

Thanks

jks
10-25-2001, 05:02 AM
Originally posted by Dilhole
Hi everyone. I use webalizer for stats on my domains. I currently have each one listed in the cronjob. I tried to setup a sh script that would run one then run the next etc...putting each on its own line. What happends is some of them loop and dont exit to the next webalizer to be run. Any ideas?


Are you _absolutely_ sure that they loop? - I.e. they could just be taking long time to run to completion. Try letting it wait a few hours and see if it completes it.

The larger logfiles you have, the longer time it takes to run Webalizer.

Remember:

1. It's a very bad idea to use Webalizer in crontabs when using logrotation.

2. You probably have a list of sites somewhere - so it's a good idea to use that, instead of having to add a line for each site for webalizer. Somewhere along the road you're bound to forget to add a domain or two to that file.

ReliableServers
10-26-2001, 02:58 AM
I ran it in verbose so I could see everything, and it would go thru 5 domains and start at the top again. It never exited or continued on to the next 10 domains. And no I dont use a logrotator, I copy the logfiles to a temp file and then truncate the main logfile(so apache doesnt have to be restarted) process the temp file then its deleted. Any ideas?

Thanks

Gunzour
10-26-2001, 06:59 PM
Can you post your shell script?

BTW, if you restart apache gracefully you don't drop any connections or have any down time, and you don't lose any log entries if you are restarting for log rotation. Something like this works:

mv access_log access_log_DATE
mv error_log error_log_DATE
/usr/local/apache/bin/apachectl graceful

When you rename the files with the mv, apache continues logging to that file even though the name has been changed (because it already has the logfile open). When you do a graceful restart, new log files are created and apache will start logging to the new log files instead of the renamed files.

The only problem with copying the log file then zeroing it out is that there is a brief period of time after you have copied the logfile and before you zero it out, and anything logged in that time would be lost.

Doug