Hi Lukasz,

Il giorno mer, 31/01/2007 alle 14.09 -0600, Lukasz Szybalski ha scritto:
> It seems as this bug was fixed in 2005. I'm not sure whether it is
> still the case in 2007.
[...]

Would you please try this patch against /etc/init.d/hylafax? It will try
a different approach in waiting for daemons. I think the current script
is probably wrong, but I cannot reproduce your bug, so I need some more
test.

Please, let me know if this fix the problem.

Thanks,
Giuseppe
--- /etc/init.d/hylafax	2006-09-19 09:31:01.000000000 +0200
+++ hylafax-initscript	2007-02-04 11:38:38.739355965 +0100
@@ -179,15 +179,13 @@
 
 daemon_stop()
 {
+
     log_daemon_msg "Stopping HylaFAX" faxq
 
     p=$(ps --no-headers -C faxq -o pid)
     if [ -n "$p" ]
     then
         start-stop-daemon --stop --exec /usr/sbin/faxq
-        sleep 1
-        p=$(ps --no-headers -C faxq -o pid)
-        [ -n "$p" ] && kill $p
     fi
 
     log_progress_msg "hfaxd"
@@ -196,9 +194,6 @@
     if [ -n "$p" ]
     then
         start-stop-daemon --stop --exec /usr/sbin/hfaxd -- $BINDTO $NEWPROT $OLDPROT $SNPP
- 	sleep 1
- 	p=$(ps --no-headers -C hfaxd -o pid)
- 	[ -n "$p" ] && kill $p
     fi
 
     if [ ${USE_FAXGETTY} = "yes" ]; then
@@ -206,12 +201,22 @@
         killall faxgetty 2> /dev/null || true
     fi
 
-    # wait maximum three seconds for server processes to shutdown
+    # wait maximum ten seconds for server processes to shutdown
     try=0
-    while [ $try -lt 3 -a 0 -lt $(ps --no-headers -Chfaxd,faxq | wc -l) ]
+    count=1
+    while [ $try -lt 10 -a 0 -lt $count ]
     do
-       sleep 1
-       try=$((try+1))
+       if [ ${USE_FAXGETTY} = "yes" ]
+       then
+         count=$(ps --no-headers -Chfaxd,faxq,faxgetty | wc -l)
+       else
+         count=$(ps --no-headers -Chfaxd,faxq | wc -l)
+       fi
+       try=$(($try+1))
+       if [ $count -gt 0 ]
+       then
+         sleep 1
+       fi
     done
 
     if [ 0 -eq "$(ps --no-headers -Chfaxd,faxq | wc -l)" ]

Reply via email to