]> git.pld-linux.org Git - packages/func.git/blobdiff - func-funcd.init
- BR: python-modules, rpm-pythonprov
[packages/func.git] / func-funcd.init
index f08838b11b8ff0c11b4e2119fa2e1344c876c210..e5b1c7022c7a0e99749528cf94f84850d8f1c92a 100644 (file)
@@ -1,48 +1,95 @@
 #!/bin/sh
 #
-# func:                Starts the func daemon
+# funcd    Fedora Unified Network Control
 #
-# Version:     @(#) /etc/rc.d/init.d/func 0.1
+# chkconfig:   2345 98 02
 #
-# chkconfig:   - 98 99
-# description: Starts and stops the func daemon at startup and shutdown..
+# description:  Crazy simple, secure remote management.
+# processname: /usr/bin/funcd
+#
+# $Id$
 
+# Source function library
 . /etc/rc.d/init.d/functions
 
+# 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_already_running "funcd"
+               return
+       fi
+
+       msg_starting "funcd"
+       daemon /usr/bin/funcd --daemon
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/funcd
+}
+
+stop() {
+       if [ ! -f /var/lock/subsys/funcd ]; then
+               msg_not_running "funcd"
+               return
+       fi
+
+       # Stop daemons.
+       msg_stopping "funcd"
+       killproc --pidfile /var/run/funcd.pid funcd -TERM
+       rm -f /var/lock/subsys/funcd
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/funcd ]; then
+               msg_not_running "funcd"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
+
 RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-       # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/funcd ]; then
-               msg_starting "funcd"
-               daemon /usr/bin/funcd
-               RETVAL=$?
-               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/funcd
-       else
-               msg_already_running "funcd"
-       fi
+       start
        ;;
   stop)
-       if [ -f /var/lock/subsys/funcd ]; then
-               msg_stopping "funcd"
-               killproc funcd
-               rm -f /var/lock/subsys/funcd
-       else
-               msg_not_running "funcd"
-       fi
+       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
 
This page took 0.088041 seconds and 4 git commands to generate.