Dear all,
I created a custom script to handle the batch process to turn on / off for a desire nodes, it work with the config file that store pool name and node ip:port with the below format. when i execute the script, it return the below error. Can anybody kindly help hand of it? many thanks.
cat testing
my-testing-pool 10.0.0.1%3:80
./nodemgmt.sh status testing1
testing: line 1: testing-80-pool: command not found
!/bin/sh
prog=“nodemgmt”
enable() { change_status “user-enabled” “user-up” }
disable() { change_status “user-disabled” “user-down” }
status() { show_status }
show_status() { for pool in $(seq 0 $((${POOL_ARRAY[@]} - 1))) do p=${POOL_ARRAY[$pool]} m=${MEMBER_ARRAY[$pool]} tmsh show ltm pool $p members {$m} done }
change_status() { for pool in $(seq 0 $((${POOL_ARRAY[@]} - 1))) do p=${POOL_ARRAY[$pool]} m=${MEMBER_ARRAY[$pool]} tmsh modify ltm pool $p members modify { $m { session $1 state $2 } } echo “$1 pool $p, member $m $2, status: $?” done }
case “$1” in user-enabled) . $2 enable ;; user-disabled) . $2 disable ;; status) . $2 status ;; *) echo $"Usage: $prog {user-enabled|user-disabled|status} config file " RETVAL=1 esac
exit $RETVAL