Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 4 of 4

This is a discussion on Problem with logrotate in the Shared & Semi-Dedicated forum
Hello, I update the stats of awstats by a script launched with logrotate: Code: /srv/www/default/logs/*log { rotate 7 daily olddir logrotate sharedscripts prerotate /usr/lib/awstats/genstat.sh endscript ...

  1. #1
    JPC Member
    Join Date
    Apr 2006
    Posts
    19

    Problem with logrotate

    Hello,

    I update the stats of awstats by a script launched with logrotate:

    Code:
    /srv/www/default/logs/*log {
        rotate 7
        daily
        olddir logrotate
        sharedscripts
        prerotate
          /usr/lib/awstats/genstat.sh
        endscript
        postrotate
            /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
        endscript
    }

    But when my logs doesn't need to be rotated, logrotate doesn't launch the script.

    How can I be sure that my logs are rotated everyday or that my script is launch even if access_log and error.log are not rotated

    Dino

  2. #2
    consultant Andre's Avatar
    Join Date
    Apr 2005
    Posts
    1,155
    Hi Dino,

    I would recommend to launch your script with a cronjob, because logrotate will only run when necessary (and doesn't really relate to stats). To do this, use:

    Code:
    crontab -e
    Then insert a line with:

    Code:
    0 0 * * * /path/to/script
    That will launch your script every day at midnight (server time). Make sure that your script has execute permissions.
    Andre van Vliet

    DEHE.com - Definition of Hosting Experts

  3. #3
    JPC Member
    Join Date
    Apr 2006
    Posts
    19
    Well... the script update the stat and build static pages. I don't want to build the pages two time per day, the days that the logs are rotated.

    For this solution, I should create a script that just update the stat before the logs are rotated.

  4. #4
    JPC Member
    Join Date
    Apr 2006
    Posts
    19
    Hiya,

    Just see that there is already one program for updating all awstats conf: awstats_updateall.pl. The conf of logrotate for httpd look like that now:
    Code:
    /Path/to/apache/logs/*log {
        rotate 7
        daily
        olddir logrotate
        sharedscripts
        prerotate
          /Path/to/awstats_updateall.pl now -awstatsprog=/Path/to/awstats.pl -configdir=/Path/to/conf's directory
        endscript
        postrotate
            /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
        endscript
    }
    And I launch the script to build the pages with cron.

    Thanks Andre,

    Dino

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •