the proposed patch is incorrect as bash needs -gt rather that > 0.

-        if [ $? > 0 ]; then
+        if [ $? -gt ]; then


Attached is my proposal.


sandro
*:-)



-- 
Sandro Dentella  *:-)
http://www.reteisi.org             Soluzioni libere per le scuole
http://sqlkit.argolinux.org        SQLkit home page - PyGTK/python/sqlalchemy
diff -r b7f9878f29f7 init.d/perdition
--- a/init.d/perdition	Mon Apr 18 11:20:22 2011 +0200
+++ b/init.d/perdition	Mon Apr 18 12:00:52 2011 +0200
@@ -50,8 +50,10 @@
       start-stop-daemon --start --verbose \
         --pidfile /var/run/perdition.pop3/perdition.pop3.pid \
         --exec /usr/sbin/perdition.pop3 -- $FLAGS $POP3_FLAGS
-        if [ ! -e /var/run/perdition.pop3/perdition.pop3.pid ]; then
-                echo "Unable to start POP3 Daemon (maybe another process is listening to the same port?)"
+        if [ $? -gt 0 ]; then
+            if [ ! -e /var/run/perdition.pop3/perdition.pop3.pid ]; then
+                 echo "Unable to start POP3 Daemon (maybe another process is listening to the same port?)"
+            fi
         fi
 
     fi
@@ -59,34 +61,41 @@
       start-stop-daemon --start --verbose \
         --pidfile /var/run/perdition.pop3s/perdition.pop3s.pid \
         --exec /usr/sbin/perdition.pop3s -- $FLAGS $POP3S_FLAGS
-        if [ ! -e /var/run/perdition.pop3s/perdition.pop3s.pid ]; then
+        if [ $? -gt 0 ]; then
+            if [ ! -e /var/run/perdition.pop3s/perdition.pop3s.pid ]; then
                 echo "Unable to start POP3S Daemon (maybe another process is listening to the same port?)"
+            fi
         fi
     fi
     if [ "$IMAP4" = "yes" ]; then 	
       start-stop-daemon --start --verbose \
         --pidfile /var/run/perdition.imap4/perdition.imap4.pid \
         --exec /usr/sbin/perdition.imap4 -- $FLAGS $IMAP4_FLAGS
-        if [ ! -e /var/run/perdition.imap4/perdition.imap4.pid ]; then
+        if [ $? -gt 0 ]; then
+            if [ ! -e /var/run/perdition.imap4/perdition.imap4.pid ]; then
                 echo "Unable to start IMAP4 Daemon (maybe another process is listening to the same port?)"
+            fi
         fi
-
     fi
     if [ "$IMAP4S" = "yes" ]; then 	
       start-stop-daemon --start --verbose \
         --pidfile /var/run/perdition.imaps/perdition.imaps.pid \
         --exec /usr/sbin/perdition.imaps -- $FLAGS $IMAP4S_FLAGS
-         if [ ! -e /var/run/perdition.imaps/perdition.imaps.pid ]; then
-                 echo "Unable to start IMAP4S Daemon (maybe another process is listening to the same port?)"
-         fi
+        if [ $? -gt 0 ]; then
+            if [ ! -e /var/run/perdition.imaps/perdition.imaps.pid ]; then
+                  echo "Unable to start IMAP4S Daemon (maybe another process is listening to the same port?)"
+            fi
+        fi
     fi
     if [ "$MANAGESIEVE" = "yes" ]; then
       start-stop-daemon --start --verbose \
         --pidfile /var/run/perdition.managesieve/perdition.managesieve.pid \
         --exec /usr/sbin/perdition.managesieve -- $FLAGS $MANAGESIEVE_FLAGS
-         if [ ! -e /var/run/perdition.managesieve/perdition.managesieve.pid ]; then
-                 echo "Unable to start MANAGESIEVE Daemon (maybe another process is listening to the same port?)"
-         fi
+        if [ $? -gt 0 ]; then
+            if [ ! -e /var/run/perdition.managesieve/perdition.managesieve.pid ]; then
+                echo "Unable to start MANAGESIEVE Daemon (maybe another process is listening to the same port?)"
+            fi
+	fi
     fi
     ;;
   stop)

Reply via email to