]> git.pld-linux.org Git - packages/func.git/commitdiff
- use new template format for init scripts
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:
    func-certmaster.init -> 1.2
    func-funcd.init -> 1.2
    func.spec -> 1.4

func-certmaster.init
func-funcd.init
func.spec

index eba288e7fd404aed376951da5497487048bf21b9..0ac1b2e76a49b83e4fa29f466b28019d471c30dc 100755 (executable)
@@ -1,48 +1,93 @@
 #!/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
 
-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
-               msg_starting "certmaster"
+               msg_starting certmaster
                daemon /usr/bin/certmaster
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/certmaster
        else
-               msg_already_running "certmaster"
+               msg_already_running certmaster
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/certmaster ]; then
-               msg_stopping "certmaster"
+               # Stop daemons.
+               msg_stopping certmaster
                killproc certmaster
+               killproc --pidfile /var/run/certmaster.pid certmaster -TERM
                rm -f /var/lock/subsys/certmaster
        else
-               msg_not_running "certmaster"
+               msg_not_running certmaster
        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
-       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
 
index f08838b11b8ff0c11b4e2119fa2e1344c876c210..52d119dc47a5f34437f5c20b69442b4fbb75dac5 100644 (file)
@@ -1,48 +1,93 @@
 #!/bin/sh
 #
-# func:                Starts the func daemon
+# funcd        funcd short service description
 #
-# Version:     @(#) /etc/rc.d/init.d/func 0.1
+# chkconfig:   - 98 2
 #
-# chkconfig:   - 98 99
-# description: Starts and stops the func daemon at startup and shutdown..
+# description: funcd long service description
+#
+# $Id$
 
+# Source function library
 . /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/funcd ] && . /etc/sysconfig/funcd
+
+# 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 funcd
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/funcd ]; then
-               msg_starting "funcd"
+               msg_starting funcd
                daemon /usr/bin/funcd
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/funcd
        else
-               msg_already_running "funcd"
+               msg_already_running funcd
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/funcd ]; then
-               msg_stopping "funcd"
+               # Stop daemons.
+               msg_stopping funcd
                killproc funcd
+               killproc --pidfile /var/run/funcd.pid funcd -TERM
                rm -f /var/lock/subsys/funcd
        else
-               msg_not_running "funcd"
+               msg_not_running funcd
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/funcd ]; then
+               stop
+               start
+       else
+               if [ $1 -ne 0 ]; then
+                       msg_not_running funcd
+               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 funcd
-       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
 
index f10c08d7731d5e57d11ca6aa9c4d90205572b4da..f6e9985b1a2f1c3a0ea035cb4ef615697b87cf75 100644 (file)
--- a/func.spec
+++ b/func.spec
@@ -31,7 +31,7 @@ python setup.py build
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/rc.d/init.d/funcd
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
 
 python setup.py install \
        --root=$RPM_BUILD_ROOT \
This page took 0.083513 seconds and 4 git commands to generate.