Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

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 

  1. root@solaris /etc/rc3.d # cat S20ip-alias
  2. #!/sbin/sh
  3. #
  4. # Copyright 2006 Andrew Alston / TENET  All rights reserved.
  5. #
  6.  
  7. [ ! -d /usr/bin ] && exit
  8.  
  9. # Start/stop processes required for ip aliasing
  10.  
  11. case "$1" in
  12. 'start')
  13.  
  14.         # If /etc/ip-aliases exists, use it to add virtual interfaces [this is syntax specific]
  15.  
  16.         if [ -f /etc/ip-aliases ]; then
  17.                 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
  18.         fi
  19.         ;;
  20.  
  21. 'stop')
  22.         if [ -f /etc/ip-aliases ]; then
  23.                 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
  24.         fi
  25.         ;;
  26. *)
  27.         echo "Usage: $0 { start | stop }"
  28.         exit 1
  29.         ;;
  30. esac
  31. 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.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

comments powered by Disqus
worth-right