d95554e8953580b85e1a41f1c78dae358732b390
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / netplug / S29netplug
1 #!/bin/sh
2 #
3 # netplugd     This shell script takes care of starting and stopping
4 #              the network plug management daemon.
5 #
6 # chkconfig: - 11 89
7 # description: netplugd is a daemon for managing non-static network \
8 #              interfaces.
9 # processname: netplugd
10 # pidfile: /var/run/netplugd.pid
11
12 # Copyright 2003 Key Research, Inc.
13
14 # Source function library.
15 if [ -f /etc/init.d/functions ]; then
16         . /etc/init.d/functions
17 elif [ -f /etc/rc.d/init.d/functions ]; then
18         . /etc/rc.d/init.d/functions
19 fi
20
21 # Source networking configuration.
22 if [ -f /etc/sysconfig/network ]; then
23         . /etc/sysconfig/network
24
25         # Check that networking is up.
26         [ ${NETWORKING} = "no" ] && exit 0
27 elif [ ! -f /etc/network/interfaces ]; then
28         # No network support
29         exit 0
30 fi
31
32 [ -x /sbin/netplugd ] || exit 0
33
34 if [ -f /etc/sysconfig/netplugd ]; then
35     . /etc/sysconfig/netplugd
36 fi
37
38 # See how we were called.
39 case "$1" in
40   start)
41         # Start daemon.
42         echo -n "Starting network plug daemon: "
43         start-stop-daemon -S -q -p /var/run/netplugd.pid -x /sbin/netplugd ${NETPLUGDARGS}
44         RETVAL=$?
45         echo
46         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/netplugd
47         ;;
48   stop)
49         # Stop daemon.
50         echo -n "Shutting down network plug daemon: "
51         start-stop-daemon -K -n netplugd
52         RETVAL=$?
53         echo
54         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/netplugd
55         ;;
56   restart|reload)
57         $0 stop
58         $0 start
59         ;;
60   condrestart)
61         [ -f /var/lock/subsys/netplugd ] && $0 restart || :
62         ;;
63   *)
64         echo "Usage: $0 {start|stop|restart}"
65         RETVAL=1
66         ;;
67 esac
68
69 exit $RETVAL