Summary: OT ssh awk question

From: Sriman Kumaran <sriman_kumaran_at_yahoo.co.uk>
Date: Wed Aug 02 2006 - 20:40:25 EDT
Hi Managers,
  
  Thanks everyone for their replies. Special thanks to Ric Anderson for fixing the script ( escaping ` and extra ; ) as below.

Ric Anderson <ric@Opus1.COM> wrote:  The backticks are being evaluated on the local host which is probably 
NOT what
you wanted and there are some missing semicolons here and there also.

The following version works for me.  Note that I changed the egrep to 
match how things
are mounted in my Solaris9 environment, and I placed an "echo" in front 
of the umount
so it didn't actually unmount things.  In this
--
myhosts="yogi
 booboo"

for mhsts in $myhosts; do
  echo doing $mhsts
  ssh $mhsts " \
   for mnts in \`/sbin/mount |grep -v vol0 |egrep 'export'|nawk '{print  
\$1}'\`; do \
      echo ===/sbin/umount -f \$mnts; \
   done"
done
--
Cheers,
Ric Anderson (ric@opus1.com)

Sriman Kumaran wrote:
> Dear scripting gurus,
>   
>  First please don't scream for asking this question here. Servers in  question are Sol 8. I am trying to unmount file systems those are  mounted remotly. My script:
>   myhosts="branch01 \
>            branch02 \
>            branch03"
>   
>   ## This part working:
>   
>   for mhsts in $myhosts
>   do
>    ssh $mhsts "mount |grep -v vol0 |egrep 'tree50[4-5]'|nawk '{print \$1}'"
>   done
>   
>   ###This part doesn't work
>   
>   for mhsts in $myhosts
>   do
>    ssh $mhsts " \
>                   for mnts in `mount |grep -v vol0 |egrep 'tree50[4-5]'|nawk '{print  \$1}'` \
>                  do \
>                   umount -f \$mnts \
>                  done"
>   done
>   
>   What am I doing wrong here? or What is the right way to achive this?
>   
>   Thanks
>   Sriman
>   
>   
>    
> ---------------------------------
>  All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
> _______________________________________________
> sunmanagers mailing list
> sunmanagers@sunmanagers.org
> http://www.sunmanagers.org/mailman/listinfo/sunmanagers
>   



 		
---------------------------------
 All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Wed Aug 2 20:41:02 2006

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:00 EST