Thursday, October 07 2004 @ 10:35 AM EDT
Contributed by: tomw
Views: 1,763
I recently upgraded my main server and installed Fedora Core 2. The logwatch on fedora emails root everyday with a summary of the activity on the server.
I liked this so much that I hacked together a cli php script that collects stats for a Geeklog site and emails it to the admin everyday.
What it does:
If my stats plugin is installed calculates # of visitors and # of pages.
Shows entries from geeklog access and error for the day.
If my ban plugin is installed it shows ip's banned for the day.
If my spamx plugin is installed it shows spamx comments rejected.
The script checks for the stats, ban and spamx plugins before collecting that information, so if you do not have them installed no problem. I have not tested this on anything other than my system so use at your own risk.
To install it simply copy the script to someplace on your server. Edit the path to your lib-common.php and perhaps the path to your php executable. And add it to your crontab. On my server the script is located at /var/www/emailstats and I wanted it to email me the info everynight at 12:30 so my crontab entry is
Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in [arthur's libcommon web path]/plugins/
stats/functions.inc on line 341