SourceForge.net Logo

B.19. /etc/init.d/network

#!/bin/ash

# GPL $Id: network,v 1.3 2005/10/09 16:39:04 cvonk Exp $
# system init for network

case "$1" in
    start)
	. /etc/sysconfig/network.conf
        hostname $HOSTNAME

	# configure interfaces
        for ii in /etc/sysconfig/network/*.conf ; do
            DEV=`basename $ii | sed 's/.conf//g;'`
	    echo -n " $DEV"
            /etc/sysconfig/network/ifup $DEV
	    if [ "$DEV" = "eth0" ] ; then
		/etc/init.d/syslogd start
	    fi
        done
	# at the minimum we need to have policies in place for basic traffic
	#/etc/init.d/firewall stop
        ;;
    stop)
        for ii in /etc/sysconfig/network/*.conf ; do
            DEV=`basename $ii | sed 's/.conf//g;'`
            /etc/sysconfig/network/ifdown $DEV
        done
        ;;
    restart)
	$0 stop
	$0 start
	;;
    status)
	ip address
	ip route
        ;;
esac

Example B.19. /etc/init.d/network