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# Create needed directories 15mkdir -p /var/lock/subsys 16 17# Source function library. 18if [ -f /etc/init.d/functions ]; then 19 . /etc/init.d/functions 20elif [ -f /etc/rc.d/init.d/functions ]; then 21 . /etc/rc.d/init.d/functions 22fi 23 24# Source networking configuration. 25if [ -f /etc/default/network ]; then 26 . /etc/default/network 27 28 # Check that networking is up. 29 [ "${NETWORKING}" = "no" ] && exit 0 30elif [ ! -f /etc/network/interfaces ]; then 31 # No network support 32 exit 0 33fi 34 35if [ -f /etc/default/netplugd ]; then 36 . /etc/default/netplugd 37fi 38 39# See how we were called. 40case "$1" in 41 start) 42 # Start daemon. 43 printf "Starting network plug daemon: " 44 start-stop-daemon -S -q -x /sbin/netplugd -- -p /var/run/netplugd.pid ${NETPLUGDARGS} 45 RETVAL=$? 46 echo 47 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/netplugd 48 ;; 49 stop) 50 # Stop daemon. 51 printf "Shutting down network plug daemon: " 52 start-stop-daemon -K -q -p /var/run/netplugd.pid 53 RETVAL=$? 54 echo 55 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/netplugd 56 ;; 57 restart|reload) 58 $0 stop 59 $0 start 60 ;; 61 condrestart) 62 [ -f /var/lock/subsys/netplugd ] && $0 restart || : 63 ;; 64 *) 65 echo "Usage: $0 {start|stop|restart}" 66 RETVAL=1 67 ;; 68esac 69 70exit $RETVAL 71