Author: qboosh                       Date: Sun Apr 13 14:50:49 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions
- fixed force-reload, added try-restart

---- Files affected:
SOURCES:
   pipslite-ekpd.init (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/pipslite-ekpd.init
diff -u SOURCES/pipslite-ekpd.init:1.1 SOURCES/pipslite-ekpd.init:1.2
--- SOURCES/pipslite-ekpd.init:1.1      Mon Jan 21 15:53:13 2008
+++ SOURCES/pipslite-ekpd.init  Sun Apr 13 16:50:43 2008
@@ -26,11 +26,7 @@
        exit 0
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-       # Check if the service is already running?
+start() {
        if [ ! -f /var/lock/subsys/ekpd ]; then
                msg_starting "EPSON KOWA Printer Daemon"
                # contains NPTL-unfriendly code
@@ -41,8 +37,9 @@
        else
                msg_already_running "EPSON KOWA Printer Daemon"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/ekpd ]; then
                msg_stopping "EPSON KOWA Printer Daemon"
                killproc ekpd
@@ -50,18 +47,42 @@
        else
                msg_not_running "EPSON KOWA Printer Daemon"
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/ekpd ]; then
+               stop
+               start
+       else
+               msg_not_running ekpd
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status ekpd
        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/pipslite-ekpd.init?r1=1.1&r2=1.2&f=u

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

Reply via email to