3 # dhcdbd DHCP Client D-BUS Daemon
6 # description: dhcdbd provides D-BUS control of the ISC DHCP client, dhclient,
7 # and D-BUS access to the DHCP options obtained by dhclient
8 # for each IPv4 interface.
10 # pidfile: /var/run/dhcdbd.pid
11 # config: /etc/dbus-1/system.d/dhcdbd.conf
15 # Source function library
16 . /etc/rc.d/init.d/functions
19 . /etc/sysconfig/network
22 [ -f /etc/sysconfig/dhcdbd ] && . /etc/sysconfig/dhcdbd
24 # Check that networking is up.
25 if is_yes "${NETWORKING}"; then
26 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
27 msg_network_down dhcdbd
35 if [ -f /var/lock/subsys/messagebus ]; then
36 if [ ! -f /var/lock/subsys/dhcdbd ]; then
38 daemon /usr/sbin/dhcdbd --system
40 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcdbd
42 msg_already_running dhcdbd
45 msg_not_running messagebus
51 if [ -f /var/run/dhcdbd.pid ]; then
52 checkpid `cat /var/run/dhcdbd.pid` >/dev/null 2>&1
54 rm -f /var/lock/subsys/dhcdbd /var/run/dhcdbd.pid >/dev/null 2>&1
59 if [ -f /var/lock/subsys/messagebus ]; then
60 if [ -f /var/lock/subsys/dhcdbd ]; then
63 --dest=com.redhat.dhcp \
66 --reply-timeout=20000 \
68 com.redhat.dhcp.quit >/dev/null 2>&1
74 rm -f /var/lock/subsys/dhcdbd /var/run/dhcdbd.pid >/dev/null 2>&1
76 msg_not_running dhcdbd
79 msg_not_running messagebus
84 if [ -f /var/lock/subsys/dhcdbd ]; then
88 msg_not_running dhcdbd
94 # See how we were called.
114 if [ $? -eq 0 ]; then
115 pid=`cat /var/run/dhcdbd.pid`
116 if [ $? -eq 0 -a -n "$pid" ]; then
117 sender=`/usr/bin/dbus-send \
119 --dest=com.redhat.dhcp \
122 --reply-timeout=20000 \
124 com.redhat.dhcp.ping |
125 grep 'sender=' | sed 's/^.*sender=//;s/\ .*$//'`
126 if [ $? -eq 0 ]; then
127 echo 'it is listening on '$sender
133 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"