If just a few scripts need to be disabled temporarily, and if they are running under the Apache::Registry handler, a maintenance message can be displayed without messing with the server. Prepare a little script in /home/httpd/perl/down4maintenance.pl:
#!/usr/bin/perl -Tw use strict; print "Content-type: text/plain\n\n", qq{We regret that the service is temporarily unavailable while essential maintenance is undertaken. It is expected to be back online from 12:20 GMT. Please, bear with us. Thank you!};
Let's say you now want to disable the /home/httpd/perl/chat.pl script. Just do this:
panic% mv /home/httpd/perl/chat.pl /home/httpd/perl/chat.pl.orig panic% ln -s /home/httpd/perl/down4maintenance.pl /home/httpd/perl/chat.pl
Of course, the server configuration must allow symbolic links for this trick to work. Make sure that the directive:
Options FollowSymLinks
is in the <Location> or <Directory>section of httpd.conf.
Alternatively, you can just back up the real script and then copy the file over it:
panic% cp /home/httpd/perl/chat.pl /home/httpd/perl/chat.pl.orig panic% cp /home/httpd/perl/down4maintenance.pl /home/httpd/perl/chat.pl
Once the maintenance work has been completed, restoring the previous setup is easy. Simply overwrite the symbolic link or the file:
panic% mv /home/httpd/perl/chat.pl.orig /home/httpd/perl/chat.pl
Now make sure that the script has the current timestamp:
panic% touch /home/httpd/perl/chat.pl
Apache::Registry will automatically detect the change and use the new script from now on.
This scenario is possible because Apache::Registry checks the modification time of the script before each invocation. If the script's file is more recent than the version already loaded in memory, Apache::Registry reloads the script from disk.
 
Continue to: