Author: glen                         Date: Tue Jul 12 21:03:30 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- unify, add try-restart

---- Files affected:
packages/slim:
   slim.init (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: packages/slim/slim.init
diff -u packages/slim/slim.init:1.4 packages/slim/slim.init:1.5
--- packages/slim/slim.init:1.4 Sun Aug 26 12:17:18 2007
+++ packages/slim/slim.init     Tue Jul 12 23:03:25 2011
@@ -20,26 +20,38 @@
 
 start() {
        # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/slim ]; then
-               msg_starting "SLiM Display Manager"
-               daemon --fork slim
-               RETVAL=$?
-               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/slim
-       else
+       if [ -f /var/lock/subsys/slim ]; then
                msg_already_running "SLiM Display Manager"
+               return
        fi
+
+       msg_starting "SLiM Display Manager"
+       daemon --fork slim
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/slim
 }
 
 stop() {
-       if [ -f /var/lock/subsys/slim ]; then
-               msg_stopping "SLiM Display Manager"
-               killproc slim
-               rm -f /var/lock/subsys/slim
-       else
+       if [ ! -f /var/lock/subsys/slim ]; then
                msg_not_running "SLiM Display Manager"
+               return
        fi
+
+       msg_stopping "SLiM Display Manager"
+       killproc slim
+       rm -f /var/lock/subsys/slim
 }
 
+condrestart() {
+       if [ ! -f /var/lock/subsys/slim ]; then
+               msg_not_running "SLiM Display Manager"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
 
 RETVAL=0
 # See how we were called.
@@ -50,16 +62,22 @@
   stop)
        stop
        ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
   status)
        status slim
        exit $?
        ;;
-  restart|force-reload)
-       stop
-       start
-       ;;
   *)
-       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/packages/slim/slim.init?r1=1.4&r2=1.5&f=u

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

Reply via email to