Code:
# cat SERVERNAMES
10.180.8.231
10.180.8.232
10.180.8.233
10.180.8.234
10.180.8.235
10.180.8.236
10.180.8.237
10.180.8.238
10.180.9.239
Code:
fn_Exit()
{
echo "Machine Doesnt exist"
exit 1 #exit shell script
}
echo "Please Enter Guest Name:"
read VM_GUEST
PATH=$(ssh -ttq root@10.180.8.231 find /var/ovs/mount -name *$VM_GUEST)
if [ -z "$PATH" ]
then
fn_Exit
else
echo "Machine Exists"
fi
fn_VMServerSearch()
{
MACHINEEXISTFLAG=$(ssh -T -q -n root@$1 xm list | grep $2)
if [ ! -z "$MACHINEEXISTFLAG" ]
then
echo "Machine $VM_GUEST Is Found At $1"
fi
}
#To Check The ServerName of Guest Machine.
while read line
do
fn_VMServerSearch "$line" "$VM_GUEST"
done < SERVERNAMES
Whenever i execute the above script i m getting following error.
Code:
# ./vm_finder_mod_V2.cgi
Please Enter Guest Name:
WIN2003-SP2
Machine Exists
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
However If i execute the code by excluding .
Code:
PATH=$(ssh -ttq root@10.180.8.231 find /var/ovs/mount -name *$VM_GUEST)
if [ -z "$PATH" ]
then
fn_Exit
else
echo "Machine Exists"
fi
What can be the issue?
I m confuesed.

I had removed the commented part from the script there fore 85 line points to line 14 in the code.
i.e.
Code:
MACHINEEXISTFLAG=$(ssh -T -q -n root@$1 xm list | grep $2)