#!/bin/sh
#!/sbin/sh
#
# ipssetup $Revision: 1.0 $ $Date: 99/03/04 13:00:00 $
#
# D. W. Eaton, Artronic Development, Phoenix, AZ -- dwe@arde.com
#
# This software is made freely available under the provisions of the Perl
# "Artistic" license:  http://language.perl.com/misc/Artistic.html
#
# This code is not supported and is not warranteed to perform any particular
# function. Contact dwe@arde.com for aditional information.
# If you find bugs or make enhancements, it would be appreciated if you
# sent them on to the author at dwe@arde.com.
#
#
#   Created for Web site aliases
#               Linux paths used
#   Save this script (or link to it) as: /etc/rc.d/init.d/ipsetup
#   Be certain the script is not writeable by any other than root
#   Place links in the /etc/rc.d/rcX.d directories to start and stop
#   For testing on my system, I chose (start before Web server/stop after):
#     cd /etc/rc.d
#     ln -s ../init.d/ipsetup rc6.d/K26ipsetup; # stop
#     ln -s ../init.d/ipsetup rc5.d/S80ipsetup; # start
#     ln -s ../init.d/ipsetup rc4.d/S80ipsetup; # start
#     ln -s ../init.d/ipsetup rc3.d/S80ipsetup; # start
#     ln -s ../init.d/ipsetup rc2.d/K26ipsetup; # stop
#     ln -s ../init.d/ipsetup rc1.d/K26ipsetup; # stop
#     ln -s ../init.d/ipsetup rc0.d/K26ipsetup; # stop
#   Adjust for your system as needed.
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH

rval=0
set_return() {
        x=$?
        if [ $x -ne 0 ]; then
                echo "EXIT CODE: $x"
                rval=1  # always 1 so that 2 can be used for other reasons
        fi
}


case $1 in
start_msg)
	echo "Starting IP address aliasing"
	;;

stop_msg)
	echo "Stopping IP address aliasing"
	;;

'start')
		ifconfig eth0:1 machinename1
		ifconfig eth0:2 machinename2
		ifconfig eth0:3 machinename3
        # (continue as needed)
		set_return
	;;

'stop')
	#
	# Stop IP addresses
	#
		ifconfig eth0:1 down
		ifconfig eth0:2 down
		ifconfig eth0:3 down
        # (continue as needed)
		set_return
	;;

*)
	echo "usage: $0 {start|stop}"
	echo " (use ifconfig to set up or stop IP aliases)"
	rval=1
	;;
esac

exit $rval
