Help Desk
By John Mark Walker, Guest Webmaster
Daisy-Fresh Content
Dear Help Desk,
Is there any way to get your Web server to email the Webmaster when a page on your site has not been updated after a certain amount of time? I'd like to be sure that our site content is always up to date.
- Scott
Dear Scott,
This isn't the sort of functionality normally associated with Web servers. However, assuming you're serving pages in a UNIX or UNIX-like environment (as any competent admin should) there is hope in the form of cron scripts and a file called crontab. This is the UNIX way to do any sort of system monitoring at regular time intervals, as specified by the administrator.
We'll start with the crontab file. On my Web server, a highly modified Red Hat Linux 6.0 machine, crontab is found in the directory /etc. For other UNIX systems, if you don't find crontab in /etc, you may want to issue the command man crontab or man cron to find out where it's located.
We'll add a line to crontab so that it will run a Perl script named web_update.pl every day at a specific time, checking the last update to a Web page. In this case, we'll choose every night at 11 p.m., but you can choose any time interval that makes sense for you. Remember that the crontab file is in the following order: minute hour day month year user command. Since we don't care about the specific day, month, or year, we've inserted * in their place. For the user column, we've designated this script to be run by root.
# Web server check
0 23 * * * root /path/to/perl /path/to/web_update.p