FreeBSD Server Administration

« 301 Redirect | Main | Mambo Revisited »

February 10, 2006

Update AwStats with Cron Job

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


Category : Apache

Posted by FreeBSD Newbie at February 10, 2006 01:05 AM

Comments

You can use 'time' for checking time command execution.
man 1 time

Posted by Anton Linevich at February 20, 2006 01:19 AM

Post a comment



(Optional, will not be shown to the public)

Remember Me?