diff options
-rwxr-xr-x | network | 42 | ||||
-rw-r--r-- | rc.conf | 2 | ||||
-rwxr-xr-x | rc.multi | 11 | ||||
-rwxr-xr-x | rc.shutdown | 7 |
4 files changed, 46 insertions, 16 deletions
@@ -0,0 +1,42 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +case "$1" in + start) + stat_busy "Starting Network" + /sbin/ifconfig lo 127.0.0.1 netmask 255.255.255.255 + ret=$? + if [ "$IPADDR" != "" -a "$NETMASK" != "" ]; then + /sbin/ifconfig eth0 $IPADDR netmask $NETMASK + ret=$? + if [ "$GATEWAY" != "" ]; then + /sbin/route add default gw $GATEWAY + fi + fi + if [ $? -gt 0 -o $ret -gt 0 ]; then + stat_fail + else + stat_done + fi + ;; + stop) + stat_busy "Stopping Network" + /sbin/ifconfig lo down + if [ ! `/sbin/ifconfig eth0 | egrep '^ *UP' &>/dev/null` ]; then + /sbin/ifconfig eth0 down + fi + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + fi + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac @@ -19,7 +19,7 @@ GATEWAY="192.168.0.1" # # Daemons to start at boot-up # -DAEMONS=() +DAEMONS=(crond inetd) # # PCMCIA @@ -11,15 +11,8 @@ if [ "$PCMCIA" = "yes" -a -f /etc/rc.d/pcmcia ]; then /etc/rc.d/pcmcia start fi -stat_busy "Starting Network" -/sbin/ifconfig lo 127.0.0.1 netmask 255.255.255.255 -if [ "$IPADDR" != "" -a "$NETMASK" != "" ]; then - /sbin/ifconfig eth0 $IPADDR netmask $NETMASK - if [ "$GATEWAY" != "" ]; then - /sbin/route add default gw $GATEWAY - fi -fi -stat_done +# Start network +/etc/rc.d/network start # Start daemons for daemon in "${DAEMONS[@]}"; do diff --git a/rc.shutdown b/rc.shutdown index b9f8296..ae7f9d0 100755 --- a/rc.shutdown +++ b/rc.shutdown @@ -21,12 +21,7 @@ if [ "$PREVLEVEL" = "2" ]; then fi # Shutdown network - stat_busy "Shutting Down Network" - /sbin/ifconfig lo down - if [ "$IPADDR" != "" -a "$NETMASK" != "" ]; then - /sbin/ifconfig eth0 down - fi - stat_done + /etc/rc.d/network stop # Shutdown pcmcia if [ "$PCMCIA" = "yes" -a -f /etc/rc.d/pcmcia ]; then |