[thelist] monthly logs linux/apache
Daniel J. Cody
djc at members.evolt.org
Tue Apr 9 15:27:02 CDT 2002
Heya John :)
Your best bet would be to use the 'logrotate' command, but if thats not
possible..
Heres a little bash script, which is *not* well written, that I use to
do something similar, a bit of changing should work for you:
#!/bin/bash
date=`date +%b-%Y`
if [ -t 0 ] #input is term
then
/path/to/apache/bin/apachectl stop
mv /home/user/log/access_log /home/user/log/access_log_$date
/path/to/apache/bin/apachectl start
else
echo "problemo!"
fi
again, just an example, and would need to be written better, but hth!
.djc.
John Corry wrote:
> I have sites hosted at he.net on (I believe) linux servers running apache.
> The log (/home/username/logs/access_log) is overwritten every month...thats
> a bummer. Is there some way I can make the server create a new log file with
> month and year appended to its name every month?
>
> :)
> John
>
More information about the thelist
mailing list