Novell Home

Choose Imaging Server based on Subnet

Novell Cool Solutions: Trench
By Jim Hoffman

Digg This - Slashdot This

Updated: 1 Jan 2005
 

Do you have a distributed network? Would you like to choose which server to pull your ZENworks images from based on what subnet the workstation is on?

Here's the code to add into your ZENworks shell script to make that happen. I suggest adding it to whatever you use as the default script. Of course, you'll need to change any reference to your specific server to the $server variable.

Example

Here's how I did it:

#Get the IP address from local info
 bigip=$(ifconfig | grep 'inet addr:')
 ip=${bigip## *addr:}
 ip=${ip%% *}
 #     echo " Your address is $ip "
 #Trim out data to get the subnet
 subnet=${ip#*.}
 subnet=${subnet%%.*}
 #     echo "  Your subnet is $subnet "
 shortip=${ip#*.}
 shortip=${shortip#*.}
 shortip=${shortip%%.*}
 #      echo "  Your short ip address is $shortip "
 #if [ shortip > 3 ]; then
 #      echo "  and you have a DHCP address "
 #else
 #      echo "  but this is not a workstation "
 #fi
#Set the local ZENWorks server
 if [ subnet=100 ]; then
    server='ZFD1'
 elif [ subnet=83 ]; then
    server='ZFD3'
 else 
    server='UNKNOWN'
    echo "Your server is $server"
    exit 1
 fi

img rp $server //$server/vol1/data/images/xpfat32.zmg ; reboot ;;

If you have any questions you may contact Jim at ryumaou@sbcglobal.net


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell