All pastes #206210 Raw Edit

Andrew Alston

public text v1 · immutable
#206210 ·published 2006-10-17 09:39 UTC
rendered paste body
root@solaris /etc/rc3.d # cat S20ip-alias 
#!/sbin/sh
#
# Copyright 2006 Andrew Alston / TENET  All rights reserved.
#

[ ! -d /usr/bin ] && exit

# Start/stop processes required for ip aliasing 

case "$1" in
'start')

        # If /etc/ip-aliases exists, use it to add virtual interfaces [this is syntax specific]

        if [ -f /etc/ip-aliases ]; then
                for i in `/usr/bin/cat /etc/ip-aliases |/usr/bin/grep -v '^#'`; do /sbin/ifconfig `/usr/bin/echo $i |/usr/bin/awk -F: '{print $1}'` addif `/usr/bin/echo $i |awk -F: '{print $2}'`; done
        fi
        ;;

'stop')
        if [ -f /etc/ip-aliases ]; then
                for i in `/usr/bin/cat /etc/ip-aliases |/usr/bin/grep -v '^#'`; do /sbin/ifconfig `/usr/bin/echo $i |/usr/bin/awk -F: '{print $1}'` removeif `/usr/bin/echo $i |awk -F: '{print $2}' |/usr/bin/sed 's/\/.*//g'`; done
        fi
        ;;
*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit 0