exit 0
fi
-[ -n "$2" ] && INTERFACES="$2"
-
-[ -z "$INTERFACES" -o "$INTERFACES" = "auto" ] && INTERFACES=$(awk -F: '/(eth|wlan)/ { print $1 }' /proc/net/dev | xargs)
-
-RETVAL=0
-# See how we were called.
-case "$1" in
- start)
+start() {
# Check if the service is already running?
for iface in $INTERFACES; do
if [ ! -f /var/lock/subsys/ifplugd.${iface} ]; then
msg_already_running "ifplugd ($iface)"
fi
done
- ;;
- stop)
+}
+
+stop() {
for iface in $INTERFACES; do
if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
msg_stopping "Network Interface Plugging Daemon ($iface)"
fi
done
rm -f /var/run/ifplugd.pid /var/lock/subsys/ifplugd.* >/dev/null 2>&1
- ;;
- suspend)
+}
+
+suspend() {
for iface in $INTERFACES; do
if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
msg_stopping "Network Interface Plugging Daemon (suspending $iface)"
msg_not_running "ifplugd ($iface)"
fi
done
- ;;
- resume)
+}
+
+resume() {
for iface in $INTERFACES; do
if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
msg_starting "Network Interface Plugging Daemon (resuming $iface)"
msg_not_running "ifplugd ($iface)"
fi
done
+}
+
+reload() {
+ if [ -f /var/lock/subsys/ifplugd ]; then
+ $0 stop
+ sleep 2
+ $0 start
+ RETVAL=$?
+ else
+ msg_not_running ifplugd
+ exit 7
+ fi
+}
+
+[ -n "$2" ] && INTERFACES="$2"
+
+[ -z "$INTERFACES" -o "$INTERFACES" = "auto" ] && INTERFACES=$(awk -F: '/(eth|wlan)/ { print $1 }' /proc/net/dev | xargs)
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ suspend)
+ suspend
+ ;;
+ resume)
+ resume
;;
restart)
- $0 stop
- $0 start
+ stop
+ start
exit $?
;;
status)
status /sbin/ifplugd
+ RETVAL=$?
for iface in $INTERFACES; do
- /sbin/ifplugd -c -i ${iface}
+ /sbin/ifplugd -c -i $iface
+ ret=$?
+ [ $ret -gt 0 ] && RETVAL=$ret
done
- exit $?
;;
reload|force-reload)
- if [ -f /var/lock/subsys/ifplugd ]; then
- $0 stop
- sleep 2
- $0 start
- RETVAL=$?
- else
- msg_not_running ifplugd
- exit 7
- fi
+ reload
;;
*)
msg_usage "$0 {start|stop|restart|reload|force-reload|status}"