]> git.pld-linux.org Git - packages/dhcdbd.git/commitdiff
- initial, based on apache.init and dhcdbd.init from sources
authorjpc <jpc@pld-linux.org>
Tue, 12 Jul 2005 22:57:17 +0000 (22:57 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    dhcdbd.init -> 1.1

dhcdbd.init [new file with mode: 0644]

diff --git a/dhcdbd.init b/dhcdbd.init
new file mode 100644 (file)
index 0000000..3b3e275
--- /dev/null
@@ -0,0 +1,112 @@
+#!/bin/sh
+#
+# dhcdbd       DHCP Client D-BUS Daemon
+#
+# chkconfig:   345 89 11
+# description: dhcdbd provides D-BUS control of the ISC DHCP client, dhclient,
+#              and D-BUS access to the DHCP options obtained by dhclient 
+#              for each IPv4 interface.
+# processname: dhcdbd
+# pidfile:     /var/run/dhcdbd.pid
+# config:      /etc/dbus-1/system.d/dhcdbd.conf
+
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config
+[ -f /etc/sysconfig/dhcdbd ] && . /etc/sysconfig/dhcdbd
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               # nls "ERROR: Networking is down. %s can't be run." <service>
+               msg_network_down dhcdbd
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       if [ -f /var/lock/subsys/messagebus ]; then
+               if [ ! -f /var/lock/subsys/dhcdbd ]; then
+                       msg_starting dhcdbd
+                       daemon dhcdbd --system
+                       RETVAL=$?
+                       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcdbd
+               else
+                       msg_already_running dhcdbd
+               fi
+       else
+               msg_not_running messagebus
+       fi
+       ;;
+  stop)
+       msg_stopping dhcdbd
+       if [ -f /var/run/dhcdbd.pid ]; then
+               checkpid `cat /var/run/dhcdbd.pid` >/dev/null 2>&1
+               if [ $? -eq 1 ]; then
+                       rm -f /var/lock/subsys/dhcdbd /var/run/dhcdbd.pid >/dev/null 2>&1
+                       died
+                       exit 0
+               fi
+       fi
+       if [ -f /var/lock/subsys/messagebus ]; then
+               if [ -f /var/lock/subsys/dhcdbd ]; then
+                       /usr/bin/dbus-send \
+                               --system \
+                               --dest=com.redhat.dhcp \
+                               --type=method_call \
+                               --print-reply \
+                               --reply-timeout=20000 \
+                               /com/redhat/dhcp \
+                               com.redhat.dhcp.quit >/dev/null 2>&1
+                       if [ $? -eq 0 ]; then
+                               rm -f /var/lock/subsys/dhcdbd /var/run/dhcdbd.pid >/dev/null 2>&1
+                       fi
+                       ok
+               else
+                       msg_not_running dhcdbd
+               fi
+       else
+               msg_not_running messagebus
+       fi
+       ;;
+  status)
+       status dhcdbd
+       if [ $? -eq 0 ]; then
+               pid=`cat /var/run/dhcdbd.pid`
+               if [ $? -eq 0 -a -n "$pid" ]; then
+                       sender=`/usr/bin/dbus-send \
+                                       --system \
+                                       --dest=com.redhat.dhcp \
+                                       --type=method_call \
+                                       --print-reply \
+                                       --reply-timeout=20000 \
+                                       /com/redhat/dhcp \
+                                       com.redhat.dhcp.ping |
+                               grep 'sender=' | sed 's/^.*sender=//;s/\ .*$//'`
+                       if [ $? -eq 0 ]; then
+                               echo 'it is listening on '$sender
+                       fi
+               fi
+       fi
+       ;;
+  restart)
+       $0 stop
+       $0 start
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|status}"
+       exit 3
+       ;;
+esac
+
+exit $RETVAL
This page took 0.068309 seconds and 4 git commands to generate.