]> git.pld-linux.org Git - packages/ifplugd.git/commitdiff
- initial script version
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Mon, 8 Sep 2003 12:48:18 +0000 (12:48 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    ifplugd.init -> 1.1

ifplugd.init [new file with mode: 0644]

diff --git a/ifplugd.init b/ifplugd.init
new file mode 100644 (file)
index 0000000..0912f60
--- /dev/null
@@ -0,0 +1,117 @@
+#!/bin/sh
+#
+# ifplugd              ifplugd
+#
+# chkconfig:   345 16 84
+#
+# description: ifplugd
+
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config
+[ -f /etc/sysconfig/ifplugd ] && . /etc/sysconfig/ifplugd
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
+               msg_network_down ifplugd
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+[ -n "$2" ] && INTERFACES="$2"
+
+[ "$INTERFACES" = "auto" ] && INTERFACES=$(awk -F: '/(eth|wlan)/ { print $1 }' /proc/net/dev | xargs)
+                       
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/ifplugd ]; then
+           for iface in $INTERFACES; do
+               msg_starting "Network Interface Plugging Daemon ($iface)"
+               args=$(eval echo \$\{ARGS_${IF}\})
+               [ -z "$args" ] && args="${ARGS}"
+               daemon /sbin/ifplugd -i ${iface} ${args}
+               NEW_RETVAL=$?
+               [ "$RETVAL" -eq "0" ] && RETVAL=${NEW_RETVAL}
+           done
+           [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ifplugd         
+       else
+           msg_already_running ifplugd
+       fi
+       ;;
+  stop)
+       if [ -f /var/lock/subsys/ifplugd ]; then
+           for iface in $INTERFACES; do
+               msg_stopping "Network Interface Plugging Daemon ($iface)"
+               daemon /sbin/ifplugd -k -i ${iface}
+               NEW_RETVAL=$?
+               [ "$RETVAL" -eq "0" ] && RETVAL=${NEW_RETVAL}
+           done
+           rm -f /var/run/ifplugd.pid /var/lock/subsys/ifplugd >/dev/null 2>&1
+       else
+           msg_not_running ifplugd
+       fi      
+       ;;
+  suspend)
+       if [ -f /var/lock/subsys/ifplugd ]; then
+           for iface in $INTERFACES; do
+               msg_stopping "Network Interface Plugging Daemon (suspending $iface)"
+               daemon /sbin/ifplugd -S -i ${iface}
+               NEW_RETVAL=$?
+               [ "$RETVAL" -eq "0" ] && RETVAL=${NEW_RETVAL}
+           done
+       else
+           msg_not_running ifplugd
+       fi
+       ;;
+   resume)
+       if [ -f /var/lock/subsys/ifplugd ]; then
+           for iface in $INTERFACES; do
+               msg_starting "Network Interface Plugging Daemon (resuming $iface)"
+               daemon /sbin/ifplugd -R -i ${iface}
+               NEW_RETVAL=$?
+               [ "$RETVAL" -eq "0" ] && RETVAL=${NEW_RETVAL}
+           done
+       else
+           msg_not_running ifplugd
+       fi
+       ;;      
+  restart)
+       $0 stop
+       $0 start
+       exit $?
+       ;;
+  status)
+       status /sbin/ifplugd
+       for iface in $INTERFACES; do
+           /sbin/ifplugd -c -i ${iface}
+       done
+       exit $?
+       ;;
+  reload|force-reload)
+       if [ -f /var/lock/subsys/ifplugd ]; then
+               $0 stop
+               sleep 2
+               $0 start
+               RETVAL=$?
+       else
+               msg_not_running ifplugd >&2
+               exit 7
+       fi
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL
This page took 0.114778 seconds and 4 git commands to generate.