Logrotate for pwserver

Results 1 to 11 of 11
  1. #1
    Nerd-IO Romulan is offline
    MemberRank
    Feb 2009 Join Date
    BelgiumLocation
    3,333Posts

    Logrotate for pwserver

    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.


  2. #2
    Proficient Member CULOBG is offline
    MemberRank
    Mar 2011 Join Date
    187Posts

    Re: Logrotate for pwserver

    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/

  3. #3
    Account Upgraded | Title Enabled! [D@nte] is offline
    MemberRank
    Apr 2010 Join Date
    249Posts

    Re: Logrotate for pwserver

    Rom ask Anubis afaik he just added some logrotate Witz compression
    Posted via Mobile Device

  4. #4
    Black Magic Development das7002 is offline
    MemberRank
    Apr 2010 Join Date
    EarthLocation
    2,188Posts

    Re: Logrotate for pwserver

    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

  5. #5
    Angelemu founder tbnanubis is offline
    MemberRank
    Mar 2011 Join Date
    Unicorn ForestLocation
    527Posts

    Re: Logrotate for pwserver

    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).

  6. #6

    Re: Logrotate for pwserver

    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.

  7. #7
    Enthusiast RolleR987 is offline
    MemberRank
    Jul 2009 Join Date
    32Posts

    Re: Logrotate for pwserver

    here is my script:
    Code:
    #!/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
    place it in /home/logservice and set it on cron
    it will not delete old logs

  8. #8
    Angelemu founder tbnanubis is offline
    MemberRank
    Mar 2011 Join Date
    Unicorn ForestLocation
    527Posts

    Re: Logrotate for pwserver

    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
    }

  9. #9
    Proficient Member Souris is offline
    MemberRank
    Feb 2009 Join Date
    167Posts

    Re: Logrotate for pwserver

    you don't need to kill logservice, use "killall -HUP logservice" instead, it will cause the process to reopen file descriptors.

  10. #10
    Valued Member elcapo is offline
    MemberRank
    Sep 2004 Join Date
    hereLocation
    111Posts

    Re: Logrotate for pwserver

    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.

  11. #11
    Nerd-IO Romulan is offline
    MemberRank
    Feb 2009 Join Date
    BelgiumLocation
    3,333Posts

    Re: Logrotate for pwserver

    @Anubis, your logrotate script is very cool but Idk why my logservice doesn't restart correctly...



Advertisement