Logging in to multiple Linux servers and running the command.

Hi,

I am trying to write a script to run a command on multiple linux based servers and get the o/p. I am using ssh to login. It is a celerra box and EMC NAS product.
I am able login but i am not able to run nas command nas_pool -size -all the NAS server. I am getting the following error.

bash: /nas/sbin/nas_pool: No such file or directory

here is my code. I have added the directory where the command or found but still the bash is not able to run the command. I tired with #!/bin/bash and #!/bin/sh none of the shell are working here is the code that I am running.

#!/bin/sh
# Linux/UNIX box with ssh key based login
SERVERS="192.168.1.1"  ## I have changed the ip addresses for security reason.
# SSH User name
USR="nasadmin"
 
# Email 
SUBJECT="Server user login report"
EMAIL="abcdefgh@gmail.com"
EMAILMESSAGE="/tmp/emailmessage.txt"
 
# create new file
>$EMAILMESSAGE
 
# connect each host and pull up user listing
for host in $SERVERS
do
echo "--------------------------------" >>$EMAILMESSAGE
echo "* HOST: $host capacity report " >>$EMAILMESSAGE
echo "--------------------------------" >>$EMAILMESSAGE
echo "for host $host "
ssh $USR@$host /nas/sbin/nas_pool -size -all >> $EMAILMESSAGE
done
 
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

I am not sure what I am missing. EMC Celerra is a propitiatory LINUX. I did get the o/p for pwd command. I am not sure why /nas/sbin/nas_pool -size -list is not working.

Any help is greatly appreciated.

I think that error msg is straightforward - your command is not found.
No permission error, no PATH error (as it has an absolute path).
When logging in interactively, can you use it? When logging in in a script, can you use e.g. ls ?

Thanks for the reply....I got the error. I was wondering why the command was not executed even after i specify the path where the command is located. I was able to get the pwd or ls out put.
I am getting o/p for regular bash commands. when I login to the box with the same credentials and run the command nas_pool ... I am able to get the o/p. Is there any specific shell do have to use ? I thought you experts might be able to help me to figure out.