Hi there
I am running a script on a central box (boxA) that will send a remote request to boxB to perform a ping test to an ip
note: I am not pinging boxB from boxA but sending a request over ssh to get boxB to perform a ping test !
The thing is, I want the script back at boxA to know whether the remote ping was successful or not ...is this possible, i tried using this 'if' test condition hoping that a true/false would come back, am i doing something wrong?
Code:
[root@boxA] # vi test
#!/bin/ksh -x
if [ `ssh boxB 'ping 172.1.1.1'` ]; then
echo "can ping from boxA"
else
echo "cant ping at all"
fi
NOTE: this ip is in fact definitely pingable from boxB but I get the following return from my script
Code:
[root@boxA] # ./test
+ FCEDIT=vi
+ export FCEDIT
+ set -o vi
+ + uname -n
PS1=boxA$
+ EDITOR=vi
+ export EDITOR
+ ssh boxB ping 172.1.1.1
+ [ 172.1.1.1 is alive ]
./test[5]: is: unknown test operator
+ echo cant ping at all
cant ping at all
As you can see from the bit highlighted in red above, the remote ping seems to be working, but how do I get my local script on boxA to be made aware of this
Any help on this would be greatly appreciated