Web Hosting Talk







View Full Version : Inactive Sites


syanet
03-08-2001, 11:25 PM
is there any script that will check for inactives sites and then delete them, or at least report them to me?

cperciva
03-09-2001, 05:29 AM
Add the lines

LogFormat "%V" sitelist
CustomLog /var/log/apache_sitelist sitelist

to httpd.conf, and create a cron job:
mv /var/log/apache_sitelist /var/log/apache_sitelist.tmp
kill -USR1 `cat /var/run/httpd.pid`
sort -u /var/log/apache_sitelist.tmp | comm -23 sitelist - | sendmail root@localhost
rm /var/log/apache_sitelist.tmp

after of course replacing /var/run/httpd.pid with the appropriate path to the .pid file for apache and replacing root@localhost with the email address you want it emailed to.

That should work, at least. I haven't tried it myself but it looks like it should work... and testing it would take another five minutes on top of the five I spent working it out.

cperciva
03-09-2001, 05:38 AM
Oh yes, and you have to replace sitelist (on the second last line) by the /path/to/file which contains a list of domains, one per line. And you might have to add in "/usr/bin/" before sort and comm and "/usr/sbin/" before sendmail.