httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@avron.ICS.UCI.EDU>
Subject admin perl scripts: restart_httpd
Date Thu, 11 May 1995 03:26:13 GMT
Here is one in a series of useful administrative perl scripts
I use to maintain our server.  Feel free to do with it what you want --
if someone wants to add it to the Apache distribution, please add the 
Apache copyright first.

 ----------------------cut here
# ==========================================================================
sub usage {
    die <<"EndUsage";
USAGE:  restart_httpd

  This program sends a SIGHUP signal to the current httpd server.
  It must be run on the www machine and by the httpd's owner. 
  The effect is to force the server to re-read its config files and
  re-open its log files.  The program tails the error_log to display
  what should be a "successful restart" message.

  Created by Roy Fielding, 10 Apr 1995

if ($#ARGV >= 0) { &usage; }
# ==========================================================================
# Get defaults


# Set up the filenames to be used

$ServerRoot = '/usr/etc/httpd';

$PidFile  = "$ServerRoot/logs/";  # Server's PID file
$ErrorLog = "$ServerRoot/logs/error_log";  # Server's Error Log

# ==========================================================================
# Restart the httpd server

if (open(PID, $PidFile))
    chop($_ = <PID>);
    kill 1, $_;
    die "Could not open httpd PID file: $!\n";

system('tail','-2', $ErrorLog);


View raw message