Centralize variables for all scripts: .env file
# global variables for all scripts export binpath=/root/script/bin export sn=`basename $0 | cut -d. -f1` export HOSTNAME=`hostname` export logpath=/root/script/log export logname=$logpath/$sn.log export configfile=$binpath/$sn.cfg export destination="test@test.com"
File_name:
spot_all_nim_clients.sh
Create a spot from a mksysb for all NIM clients:
#!/bin/ksh #set -x ############################################# #@(#) Create a spot from a mksysb for all NIM clients # To verify the mksysb integrity, best way is to build a SPOT # from the mksysb ############################################# # version 1.0 21-09-2015 ############################################# dir=`dirname $0` . $dir/.env spotpath=/export/spot main () { date "+%d-%m-%Y %H:%m" allhost=$(lsnim -t standalone | sort | awk '{print $1}') for client in $allhost do print "*****************************************" print "Remove old spot for host $client" if [ $(lsnim -t spot | awk '{print $1}') == "spot_${client}" ] then nim -o remove spot_${client} fi nim -o define -t spot -a server=master -a source=mksysb_${client} -a location=$spotpath spot_${client} if [ $? -ne 0 ] then print "*****************************************" print "** ERROR spot Failed on host $client, bad MKSYSB **" print "*****************************************" else print "** spot Successful on host $client **" nim -o remove spot_${client} fi done date "+%d-%m-%Y %H:%m" } main | tee $logname 2>&1