]> git.pld-linux.org Git - packages/3DM2-9650SE.git/commitdiff
- pldize
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 7 Mar 2007 10:13:03 +0000 (10:13 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    3dm2-9650SE.init -> 1.2

3dm2-9650SE.init

index 355b09c7d9fb37e9b33adc9edd4d8e600f8a290c..efde7548217ccce2ea9cdaab2ed7531d584693e1 100644 (file)
 
 RETVAL=0
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
        if [ ! -f /var/lock/subsys/3dm2 ]; then
            msg_starting "3DM2 Utility"
            start-stop-daemon --start --quiet --exec /usr/sbin/3dm2
            RETVAL=$?
-           if [ $RETVAL -eq 0 ]; then 
-               ok 
-               touch /var/lock/subsys/3dm2
+           if [ $RETVAL -eq 0 ]; then
+                       ok
+                       touch /var/lock/subsys/3dm2
            else
-               fail
-               RETVAL=1
+                       fail
+                       RETVAL=1
            fi
        else
            msg_already_running "3DM2 Utility"
        fi
-       ;;
-  stop)
+}
+
+stop() {
+       # FIXME: stop should NEVER fail with error code
        if [ -f /var/lock/subsys/3dm2 ]; then
            msg_stopping "3DM2 Utility"
-           start-stop-daemon --stop --quiet --exec /usr/sbin/3dm2 1> /dev/null
+               # FIXME: spec needs rc-scripts versioned dep for start-stop-daemon (see PLD-doc/BuildRequires.txt)
+           start-stop-daemon --stop --quiet --exec /usr/sbin/3dm2 > /dev/null
            RETVAL=$?
-           if [ $RETVAL -eq 0 ]; then 
-               ok 
-               rm -f /var/lock/subsys/3dm2
+           if [ $RETVAL -eq 0 ]; then
+                       ok
+                       rm -f /var/lock/subsys/3dm2
            else
-               fail
-               RETVAL=1
+                       fail
+                       RETVAL=1
            fi
        else
            msg_not_running "3DM2 Utility"
        fi
+}
+
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   status)
        status 3dm2
        RETVAL=$?
        ;;
   restart)
-       $0 stop
+       stop
        sleep 2
-       $0 start
-       RETVAL=$?
+       start
        ;;
   *)
-       echo "Usage: $0 {start|stop|status|restart}"
-       exit 1
+       msg_usage "$0 {start|stop|status|restart}"
+       exit 3
 esac
 
 exit $RETVAL
This page took 0.075294 seconds and 4 git commands to generate.