[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Registration with a webserver - how to restart



Hi Sean, 

Thanks for your comments, they pretty much agreed with what I was
thinking. Good to have confirmation that I'm not completely off the
track.

On Thu, 2005-10-13 at 09:29 -0400, sean finney wrote:

> > Is there a best practice in these areas?
> 
> if you're really curious, take a look at the webapps-common package
> in cvs on alioth.  in there, you'll find a file called internal/httpd,
> which should have a bunch of really useful functions, which could 
> serve as a reference perhaps for something you could do in your
> own package.

OK. These are great, I'll just copy them into my postinst etc for now
until the package makes it into unstable. I've added appropriate
comments noting that the functions are written by you as part of the
webapps-common package. 

> on that vein, i am planning on releasing the package a little more
> publicly than it currently is.  if you'd be interested in being
> a test subject, let me know :)

Sure, I've attached a patch to fix a bug in the wc_httpd_invoke
function. The function should operate on the list of running httpds, not
any supported httpd.

There is also a bug in wc_httpd_running that prevents it from detecting
that apache2 is running. This is due to apache2 being started with
command line options and the use of the -fx flags. See the following
situation.

Trimmed ps aux output
root     17453  0.0  1.7  10840  4428 pts/0    S    Oct17   0:00 /usr/sbin/apache
www-data 17454  0.4  5.2  19548 13096 pts/0    S    Oct17   0:04 /usr/sbin/apache
root     17481  0.0  1.9  12908  4836 ?        Ss   Oct17   0:00 /usr/sbin/apache2 -k start -DSSL
www-data 17482  0.0  4.6  20120 11596 ?        S    Oct17   0:00 /usr/sbin/apache2 -k start -DSSL

# pgrep -fx /usr/sbin/apache
17453
17454
# pgrep -fx /usr/sbin/apache2
#

# cat /proc/17453/cmdline
/usr/sbin/apache
# cat /proc/17481/cmdline
/usr/sbin/apache2-kstart-DSSL

Dropping -f and using commands such as pgrep -x apache, or pgrep -x
apache2 would seem to be the best option here.

Cheers

-- 
Matt Brown
matt@mattb.net.nz
Mob +64 275 611 544 www.mattb.net.nz
Index: httpd
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/internal/httpd,v
retrieving revision 1.3
diff -u -r1.3 httpd
--- httpd	17 Aug 2005 16:40:41 -0000	1.3
+++ httpd	17 Oct 2005 11:22:10 -0000
@@ -63,7 +63,7 @@
 	if [ "$*" ]; then
 		httpds=$*
 	else
-		httpds=$wc_httpd_supported
+		httpds=$wc_httpd_running
 	fi
 	for f in $httpds; do
 		if [ -x /etc/init.d/$f ]; then

Reply to: