]> git.pld-linux.org Git - packages/stunnel.git/blobdiff - stunnel.init
- up to 5.62
[packages/stunnel.git] / stunnel.init
index 6d202b3308a119165374b7e74e0e08be8eaa59e8..e4ca5f84b76661bacfa1f448f75f6e7b940f3119 100644 (file)
@@ -2,7 +2,7 @@
 #
 # stunnel      stunnel (Universal SSL tunnel)
 #
-# chkconfig:   345 14 91       
+# chkconfig:   345 14 91
 #
 # description: stunnel (Universal SSL tunnel)
 #
@@ -34,10 +34,7 @@ if [ ! -f "$STUNNEL_CONFIG" ]; then
        exit 1
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/stunnel ]; then
                msg_starting stunnel; busy
@@ -47,27 +44,53 @@ case "$1" in
        else
                msg_already_running stunnel
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/stunnel ]; then
                msg_stopping stunnel
                killproc stunnel
                rm -f /var/run/stunnel/stunnel.pid /var/lock/subsys/stunnel >/dev/null 2>&1
        else
                msg_not_running stunnel
-       fi      
+       fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/stunnel ]; then
+               stop
+               start
+       else
+               msg_not_running stunnel
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status stunnel
        exit $?
        ;;
   *)
-       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.070633 seconds and 4 git commands to generate.