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.