I have requiremnt to send mail with the server name which is stopped state.
---------- Post updated at 07:41 AM ---------- Previous update was at 05:52 AM ----------
bash-3.00$ ./wsadmin.sh -lang jython -f /opt/app/ccr/home/ccr/scripts/ccrserverstatus.py | grep -i start | awk '{ print $2 }' | while read server;
> do
> if [ $server = "clustServer1*" ]
> then
> echo "$server is running fine on ccrtoolsvcp1"
> else
> echo "$server is running fine on ccrtoolsvcp3"
> fi
> done
clustServer11 is running fine on ccrtoolsvcp3
clustServer12 is running fine on ccrtoolsvcp3
clustServer13 is running fine on ccrtoolsvcp3
clustServer21 is running fine on ccrtoolsvcp3
clustServer22 is running fine on ccrtoolsvcp3
My requirement is if server is clustserver11,12 and 13 then it should execute following echo command.
echo "$server is running fine on ccrtoolsvcp1"
and if server is clustserver21 and 22 then it should execute following echo command.
echo "$server is running fine on ccrtoolsvcp3"
But this is not happening now. It is going in else statement only and not comparing comment in if command.
Thanks for the response. But it didnt worked. It is not comparing string in if statement and directly going to else statement.
bash-3.00$ server=clustServer11
bash-3.00$ if [ "$server" = "clustServer1.*" ]
> then
> echo "$server is running fine on ccrtoolsvcp1"
> else
> echo "$server is not running"
> fi
clustServer11 is not running
bash-3.00$