10 # Source function library
11 . /etc/rc.d/init.d/functions
14 . /etc/sysconfig/network
17 [ -f /etc/sysconfig/ifplugd ] && . /etc/sysconfig/ifplugd
19 # Check that networking is up.
20 if is_yes "${NETWORKING}"; then
21 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
22 msg_network_down ifplugd
30 # Check if the service is already running?
31 if [ ! -f /var/lock/subsys/ifplugd ]; then
32 for iface in $INTERFACES; do
33 if [ ! -f /var/lock/subsys/ifplugd.${iface} ]; then
34 msg_starting "Network Interface Plugging Daemon ($iface)"
35 args=$(eval echo \$\{ARGS_${IF}\})
36 [ -z "$args" ] && args="${ARGS}"
37 daemon /sbin/ifplugd -i ${iface} ${args}
39 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ifplugd.${iface}
41 msg_already_running "ifplugd ($iface)"
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ifplugd
46 msg_already_running "Network Interface Plugging Daemon"
51 if [ -f /var/lock/subsys/ifplugd ]; then
52 for iface in $INTERFACES; do
53 if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
54 msg_stopping "Network Interface Plugging Daemon ($iface)"
55 daemon /sbin/ifplugd -k -i ${iface}
58 msg_not_running "ifplugd ($iface)"
61 rm -f /var/run/ifplugd.pid /var/lock/subsys/ifplugd* >/dev/null 2>&1
63 msg_not_running "Network Interface Plugging Daemon"
67 [ -n "$2" ] && INTERFACES="$2"
69 [ -z "$INTERFACES" -o "$INTERFACES" = "auto" ] && INTERFACES=$(awk -F: '/(eth|wlan)/ { print $1 }' /proc/net/dev | xargs)
72 # See how we were called.
85 for iface in $INTERFACES; do
86 if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
87 msg_stopping "Network Interface Plugging Daemon (suspending $iface)"
88 daemon /sbin/ifplugd -S -i ${iface}
91 msg_not_running "ifplugd ($iface)"
96 for iface in $INTERFACES; do
97 if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
98 msg_starting "Network Interface Plugging Daemon (resuming $iface)"
99 daemon /sbin/ifplugd -R -i ${iface}
102 msg_not_running "ifplugd ($iface)"
109 for iface in $INTERFACES; do
110 /sbin/ifplugd -c -i $iface
112 [ $ret -gt 0 ] && RETVAL=$ret
116 if [ -f /var/lock/subsys/ifplugd ]; then
122 msg_not_running ifplugd
127 msg_usage "$0 {start|stop|restart|reload|suspend|resume|force-reload|status}"