Someone could share his script for logrotate for pwserver logs? It would be very cool... Or if you have any idea how to clean my logs automaticaly every weeks.
Someone could share his script for logrotate for pwserver logs? It would be very cool... Or if you have any idea how to clean my logs automaticaly every weeks.
just yesterday i was looking for something like that lol i found this old thread and dunno if it works and if you already tried it :
http://forum.ragezone.com/f694/autom...reboot-718887/
Rom ask Anubis afaik he just added some logrotate Witz compression
Posted via Mobile Device
logrotate
It isn't a script. it is the logrotated service. Webmin has a module for I if you are using that, but the CLI for it is easy to use and understand.
Edit: I mentioned something similar in the thread CULOBG mentioned.
Posted via Mobile Device
a friend did that to our server, the basic functionality is: add world2.log and world2.trace to logrotate servive weekly, and restart logservice after that( or just recreate that files with cat /dev/null >world2.log).
I used to use Bz2 for my log files with bash script and cron, the compression was great, a bit hard on the cpu though.
oh yeah i forgot to add, i also did date +-%H:%M:%S--%h_%d_%Y so they didnt overwrite each other.
here is my script:
place it in /home/logservice and set it on cronCode:#!/bin/sh pkill -9 logservice sleep 5 t=`date "+%Y-%m-%d_%H:%M"` sleep 5 cd /home/logservice mv logs $t sleep 5 mkdir logs sleep 5 cd /home/logservice; ./logservice logservice.conf >/home/logs/logservice.log & sleep 5
it will not delete old logs
our logrotate config, exchange the startup and kill command for logservice to fit your needs. su is used to start it with the user "pw"
put it in a new file in /etfc/logrotate.d/
Code:/home/pw/logservice/logs/world2.trace /home/pw/logservice/logs/world2.log { weekly missingok rotate 52 compress delaycompress notifempty create 644 pw users sharedscripts postrotate pkill -9 logservice 1>/dev/null 2>/dev/null && su -c "cd /home/pw/logservice && /usr/bin/screen -dmS logservice ./logservice logservice.conf 1>/dev/null 2>/dev/null" - pw endscript }
you don't need to kill logservice, use "killall -HUP logservice" instead, it will cause the process to reopen file descriptors.
I have a script that pretty much does the same as RolleR987 posted, and use crontab to run it every 4 hours. So I backup all logs, and then, have some PHP scripts to analize it and work in it.
The same for database backups. Thought that database backups couldnt be achieved with running processes, but it does work.
@Anubis, your logrotate script is very cool but Idk why my logservice doesn't restart correctly...