Paste Description for Andrew Alston
Basic script for rc3.d to handle virtual addresses in solaris slightly more cleanly
- Andrew Alston
- Tuesday, October 17th, 2006 at 9:39:36am UTC
- 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
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.