SOURCES: dhcdbd.init (NEW) - initial, based on apache.init and dhc...

jpc jpc at pld-linux.org
Wed Jul 13 00:57:22 CEST 2005


Author: jpc                          Date: Tue Jul 12 22:57:22 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- initial, based on apache.init and dhcdbd.init from sources

---- Files affected:
SOURCES:
   dhcdbd.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/dhcdbd.init
diff -u /dev/null SOURCES/dhcdbd.init:1.1
--- /dev/null	Wed Jul 13 00:57:22 2005
+++ SOURCES/dhcdbd.init	Wed Jul 13 00:57:17 2005
@@ -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
================================================================



More information about the pld-cvs-commit mailing list