Home > Apache > Update AwStats with Cron Job

Update AwStats with Cron Job

February 10, 2006 Posted by KP

In the next few days, I will try to automate the server maintenance as much as possible – ideally, I don’t have to logon the server for months if I don’t want to. Summer is coming :-) .

I know little about shell scripts, let me start from an easy one – AwStats.

Name the update script as “awstats_update_all.sh” with the following content:
#!/bin/sh
cd /usr/local/www/awstats/tools/
./awstats_updateall.pl now -awstatsprog=/usr/local/www/awstats/cgi-bin/awstats.pl

The script is also an ideal place to syncronize the server time, ntpd is overkill with annoying output.
/usr/sbin/ntpdate pool.ntp.org

I also want to know the execution time, so my complete version is:
#!/bin/sh
cd /usr/local/www/awstats/tools/
date
./awstats_updateall.pl now -awstatsprog=/usr/local/www/awstats/cgi-bin/awstats.pl
date
/usr/sbin/ntpdate pool.ntp.org

Put it in cron job, update daily at 2:01am:
01 02 * * * /home/some_account/awstats_update_all.sh



Related Posts:

Filed Under: Apache

One Comment to “Update AwStats with Cron Job”

  1. Anton Linevich Says:

    You can use ‘time’ for checking time command execution.
    man 1 time

Leave a Comment

(required)
(will not be published, required)

* Copy this password:

* Type or paste password here:






Archives

Links