]> git.pld-linux.org Git - packages/FreeWnn.git/blobdiff - FreeWnn.init
- updated init scripts (added try-restart, adjusted force-reload exit codes wrt....
[packages/FreeWnn.git] / FreeWnn.init
index 400c21bc66b037b396a4c438b93f54bdf9bdeee9..a76a56c1f86ef05cb6761e4ed12c92625a082621 100644 (file)
@@ -32,10 +32,7 @@ if [ -f /etc/FreeWnn/ja/jserverrc ]; then
        exit 6
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-    start)
+start() {
        if [ ! -f /var/lock/subsys/FreeWnn ]; then
                msg_starting FreeWnn
                rm -f /tmp/jd_sockV4
@@ -46,8 +43,9 @@ case "$1" in
        else
                msg_already_running FreeWnn
        fi
-       ;;
-    stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/FreeWnn ]; then
                msg_stopping FreeWnn
                killproc jserver
@@ -55,18 +53,43 @@ case "$1" in
        else
                msg_not_running FreeWnn
        fi
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/FreeWnn ]; then
+               msg_not_running FreeWnn
+               RETVAL=$1
+               return
+       fi
+       stop
+       start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
-    status)
+  status)
        status jserver
-       exit $?
+       RETVAL=$?
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
        ;;
-    restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+  force-reload)
+       condrestart 7
        ;;
-    *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+  *)
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
        ;;
 esac
This page took 0.060237 seconds and 4 git commands to generate.