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

Bookmark and Share


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









*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word


Categories

Archives

Links

Meta