Package: apt-proxy
Version: 1.9.25
Followup-For: Bug #284432

Additionally to the previous patch, now
- no sleep anymore at "restart" between stop and start
- no error message of "cat $pidfile" in case "apt-proxy restart"
  or "apt-proxy stop" is called when apt-proxy is already stopped
  (and so pidfile isn't available).


===================================================================
RCS file: /etc/init.d/RCS/apt-proxy,v
retrieving revision 1.1
diff -u -r1.1 /etc/init.d/apt-proxy
--- /etc/init.d/apt-proxy       2005-01-28 11:24:02+01  1.1
+++ /etc/init.d/apt-proxy       2005-02-21 10:11:38+01
@@ -15,6 +15,21 @@
 test -x $twistd || exit 0
 test -r $application || exit 0
 
+# return true if at least one pid is alive
+function alive()
+{
+    if [ -z "$*" ]; then
+       return 1
+    fi
+    for i in $*; do
+       if kill -0 $i 2> /dev/null; then
+           return 0
+       fi
+    done
+
+    return 1
+}
+
 
 case "$1" in
     start)
@@ -32,15 +47,23 @@
     ;;
 
     stop)
-       echo -n "Stopping apt-proxy"
-       start-stop-daemon --stop --quiet \
-               --pidfile $pidfile
-       echo "."        
+       echo -n "Stopping apt-proxy [wait"
+       count=0
+       pid=$(cat $pidfile 2>/dev/null)
+       while alive $pid; do
+               start-stop-daemon --stop --quiet --pidfile $pidfile
+               count=$(expr $count + 1)
+               if [ $count -gt 20 ]; then
+                       break;
+               fi
+               echo -n " $count"
+               sleep 1
+       done
+       echo "] done."  
     ;;
 
     restart)
        $0 stop
-       sleep 1
        $0 start
     ;;
===================================================================
     
-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7-1-k7
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages apt-proxy depends on:
ii  bzip2                         1.0.2-1    A high-quality block-sorting file 
ii  debconf                       1.4.30.11  Debian configuration management sy
ii  logrotate                     3.7-2      Log rotation utility
ii  python                        2.3.4-5    An interactive high-level object-o
ii  python-apt                    0.5.10     Python interface to libapt-pkg
ii  python-bsddb3                 3.3.0-6    Python interface to libdb3
ii  python-twisted                1.3.0-6    Event-based framework for internet

-- debconf information excluded


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to