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

The problem with the logrotate script is, that /etc/init.d/apt-proxy
doesn't wait on "stop" resp. "restart" until the apt-proxy server
really died before starting the new one.

If the old one didn't yet terminate, the new one won't start and
complains insted, which causes the logrotate mail.

On the other side, the old process finally will die, so no apt-proxy
server is available afterwards.

The following patch will help (partly taken from /etc/init.d/autofs):

===================================================================
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:00:11+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,10 +47,19 @@
     ;;
 
     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)
+       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)
===================================================================

-- 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