perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John ORourke <john-modp...@o-rourke.org>
Subject Re: Restarting Apache2.2 from PERL
Date Wed, 29 Aug 2007 12:23:30 GMT
Matthieu FEREYRE wrote:
>
> kill -USR1 apache_pid
>
> do that extremly well but apache doesn't have the rights to launch it 
> from perl !
>

Try writing a script which does it - eg.

#!/bin/sh
/etc/init.d/apache restart

put that somewhere and make it setuid root, then in your perl code call

system("/path/to/your/script &");

which would launch it in the background and return control sensibly, I 
think.

The 2 flaws are [1] you have no way to feed back success to the user - 
you could put a Refresh header in the returned page to jump to a status 
page - and [2] any script or user on your server would be able to 
restart it by running the setuid root script.

cheers
John


Mime
View raw message