]> git.pld-linux.org Git - packages/certmaster.git/commitdiff
- use new template format for init scripts AC-branch
authorPatryk Zawadzki <patrys@room-303.com>
Sun, 9 Dec 2007 13:01:12 +0000 (13:01 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- fix packaging

Changed files:
    certmaster.init -> 1.2

certmaster.init

index eba288e7fd404aed376951da5497487048bf21b9..0ac1b2e76a49b83e4fa29f466b28019d471c30dc 100644 (file)
@@ -1,48 +1,93 @@
 #!/bin/sh
 #
 #!/bin/sh
 #
-# func:                Starts the func certmaster daemon
+# certmaster   certmaster short service description
 #
 #
-# Version:     @(#) /etc/rc.d/init.d/func 0.1
+# chkconfig:   - 97 3
 #
 #
-# chkconfig:   - 98 99
-# description: Starts and stops the func daemon at startup and shutdown..
+# description: certmaster long service description
+#
+# $Id$
 
 
+# Source function library
 . /etc/rc.d/init.d/functions
 
 . /etc/rc.d/init.d/functions
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/certmaster ] && . /etc/sysconfig/certmaster
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down certmaster
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/certmaster ]; then
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/certmaster ]; then
-               msg_starting "certmaster"
+               msg_starting certmaster
                daemon /usr/bin/certmaster
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/certmaster
        else
                daemon /usr/bin/certmaster
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/certmaster
        else
-               msg_already_running "certmaster"
+               msg_already_running certmaster
        fi
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/certmaster ]; then
        if [ -f /var/lock/subsys/certmaster ]; then
-               msg_stopping "certmaster"
+               # Stop daemons.
+               msg_stopping certmaster
                killproc certmaster
                killproc certmaster
+               killproc --pidfile /var/run/certmaster.pid certmaster -TERM
                rm -f /var/lock/subsys/certmaster
        else
                rm -f /var/lock/subsys/certmaster
        else
-               msg_not_running "certmaster"
+               msg_not_running certmaster
        fi
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/certmaster ]; then
+               stop
+               start
+       else
+               if [ $1 -ne 0 ]; then
+                       msg_not_running certmaster
+               fi
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status certmaster
        ;;
   status)
        status certmaster
-       exit $?
-       ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+       RETVAL=$?
        ;;
   *)
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
        exit 3
 esac
 
This page took 0.111771 seconds and 4 git commands to generate.