The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

remove the files log every week

Discussion in 'General Discussion' started by powerflash, Jan 28, 2005.

  1. powerflash

    powerflash Active Member

    Joined:
    Nov 1, 2004
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    I must remove the logs file from /etc/httpd/domlogs every week ... like must I config the crontab??.. what are the command?? ... rm??

    Thanks
    Alessio
     
  2. JayPee

    JayPee Member

    Joined:
    Mar 2, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Coimbatore, India
    Hi,

    After logged your server through SSH with root privilege, follow the given steps to clear the domain logs every sunday.

    step1:

    vi /root/clear_log.sh


    cd /usr/local/apache/domlogs
    for i in $( ls )
    echo > $i
    done


    #Note: press "Esc" key and type :wq and presss "enter" key to save the above contents.


    step2:

    chmod 700 /root/clear_log.sh



    step3:

    vi /var/spool/cron/root

    #Note: add the following line at the bottom of this file.

    * * * * 0 sh /root/clear_log.sh

    #Note: press "

    Esc" key and type :wq and presss "enter" key to save the above contents

    .
     
  3. powerflash

    powerflash Active Member

    Joined:
    Nov 1, 2004
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    ok,

    Thanks
    Alessio
     
  4. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    you left out the do in the script

    this:
    cd /usr/local/apache/domlogs
    for i in $( ls )
    echo > $i
    done


    should be:
    cd /usr/local/apache/domlogs
    for i in $( ls )
    do
    echo > $i
    done
     
  5. Jemshi

    Jemshi Well-Known Member

    Joined:
    Sep 11, 2003
    Messages:
    210
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India

    Better option is to use the whm's feature of clearing the logs after stats update each day. In the other case where you clear it using some script, chances are that, it runs before stats update on that day and thus missing entries for that day in the stats.

    HTH,
    Jemshad O K
    Bobcares
    http://bobcares.com
    http://poornam.com
     
    #5 Jemshi, Jan 29, 2005
    Last edited: Jan 29, 2005
  6. powerflash

    powerflash Active Member

    Joined:
    Nov 1, 2004
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    in Tweak Setting/Stats and Logs:

    ([] Delete each domain's access logs after stats run)

    it is???

    Thanks
    Alessio
     
  7. powerflash

    powerflash Active Member

    Joined:
    Nov 1, 2004
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    I have the remove this line in crontab file root:

    * * * * 0 sh /root/clear_log.sh



    .. but I received each minute this error:

    /root/clear_log.sh: /root/clear_log.sh: No such file or directory
     
  8. Jemshi

    Jemshi Well-Known Member

    Joined:
    Sep 11, 2003
    Messages:
    210
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Yes. That has the additional advantage that logs wont go much larger in size and cause the stats programs (awstats, webalizer, analog etc) to choke on reading and parsing those large files. End result is, much lesser load for the server :)
     
  9. Jemshi

    Jemshi Well-Known Member

    Joined:
    Sep 11, 2003
    Messages:
    210
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    try service crond restart
     
  10. powerflash

    powerflash Active Member

    Joined:
    Nov 1, 2004
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    ok, now it is regular ;)
     
Loading...

Share This Page