Author: qboosh                       Date: Wed Nov 28 20:14:35 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions
- force-reload is not supposed to start service if not running
- added try-restart action (LSB 3.1)

---- Files affected:
SOURCES:
   LPRng.init (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: SOURCES/LPRng.init
diff -u SOURCES/LPRng.init:1.7 SOURCES/LPRng.init:1.8
--- SOURCES/LPRng.init:1.7      Thu Jul  3 23:01:49 2003
+++ SOURCES/LPRng.init  Wed Nov 28 21:14:30 2007
@@ -34,10 +34,7 @@
 # Sanity check
 [ -f /etc/printcap ] || exit 0
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/lpd ]; then
                msg_starting LPRng
@@ -47,8 +44,9 @@
        else
                msg_already_running "LPRng"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/lpd ]; then
                msg_stopping "LPRng"
                killproc lpd
@@ -56,18 +54,43 @@
        else
                msg_not_running "LPRng"
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/lpd ]; then
+               stop
+               start
+       else
+               msg_not_running "LPRng"
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status lpd
        exit $?
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
-       ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/LPRng.init?r1=1.7&r2=1.8&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to