Shell Script fails with "can't connect to client"

Hi Unix Gurus,

I have written a shell script to unfreeze all frozen media in NetBackup. Here is the script written on HP-UX using ksh:
***********************************************
set -x
cd $HOME
rm -f frozentest
rm -f mediaserver

cd /usr/openv/netbackup/bin/admincmd

pbrun ./bpmedialist -summary | grep FROZEN | awk '{print $1 $2}' | grep FROZEN | cut -c 1-6 >>$HOME/frozentest

for i in `cat $HOME/frozentest`
do
pbrun ./bpmedialist -m $i | grep Server | cut -f 4 -d " " > $HOME/mediaserver
for j in `cat $HOME/mediaserver`
do
pbrun ./bpmedia -unfreeze -m $i -h $j
echo "$i of $j has been unfreezed"
done
done
***********************************************

This script should find all the frozen media and unfreeze them automatically. However the script is not working as expected. While running the last command (pbrun ./bpmedia -unfreeze -m $i -h $j) it is getting failed with "can't connect to client" error. I have written one more script using different logic even that is also getting failed with the same error. I am sure that there is no syntax errors in my logic and it could be something else which is failing the script. I am using ksh. Please let me know what could be the problem. Any suggestions on this would be greatly appreciated.

Thanks in Advance,
Srinivas Rao S.

Hi Srinivas,
The 'can't connect to client' error is not due to the script. It is due to connectivity issues between the netbackup master and the client or the media server and the client. If you are using a dedicated private lan for backup connectivity, make sure that the client that you are trying to connect to is reachable from the server where you are running the bpmedia command.

Hi blowtorch,

I appreciate your earliest response. I am running this script on the master server and this script doesn't depend on any clients because no media database is stored on clients. This script picks all frozen media from media database located on media servers and unfreezes them. We are using a dedicated backup lan and the connectivity between the master and media servers is perfectly working fine.

I am running this command as an ordinary user and hence I have used pbrun in my script. I have also tried running this script as a super user with my Unix admin help and it worked perfectly. As per my Unix admin this could be due to permissions. He suggested me using "while" loop instead of "for" loop in the script and this may resolve the issue(not sure) because "for" loop issues the commands parallely but "while" issues commands one at a time.

Appreciate your suggestions on this to run my script successfully.

Thanks in Advance,
Srinivas Rao S.