vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I am trying to read from a file for the list of servers and then instruct the script to login on these servers and run a command to check one text file. So far its done the below way... cat server-list | \ while read line do echo "------------------------------------------------" >>test.out echo " HOST : $line" >>test.out echo "_____________________________________________ ___" >>test.out rsh $line cat /home/basks.tbl|awk '{ print $1 }' >>test.out done The problem seems to be that script does not work !!! :-) Any ideas around using cat wiht the while loop in a better way ? |
| |||
| On Apr 22, 9:11*am, invincible <imanuk2...@googlemail.com> wrote: > I am trying to read from a file for the list of servers and then > instruct the script to login on these servers and run a command to > check one text file. > > So far its done the below way... > > cat server-list | \ > while read line > do > echo "------------------------------------------------" >>test.out > echo " HOST : $line" >>test.out > echo "_____________________________________________ ___" >>test.out > rsh $line cat /home/basks.tbl|awk '{ print $1 }' >>test.out > done > > The problem seems to be that script does not work !!! * :-) > > Any ideas around using cat wiht the while loop in a better way ? why recreate what is already provided to you? man dsh |
| |||
| >> man dsh dsh is part of csm (or pssp if you still run it) and not everyone has csm right ? >> The problem seems to be that script does not work !!! :-) Depends what your error is .. >> Any ideas around using cat wiht the while loop in a better way ? for host in $(cat server-list) do rsh ${host} "awk '{print $1}' /home/basks.tbl" >> test.out done Any good to you ? Rgds Mark Taylor |
| |||
| On Apr 22, 3:43 pm, Mark Taylor <m...@talk21.com> wrote: > >> man dsh > > dsh is part of csm (or pssp if you still run it) and not everyone has > csm right ? .... The dsh is provided from the csm.dsh package which is available since AIX 5.3 ( Maybe even AIX 5.2 ) and i believe its even installed by default. cheers Hajo |
| |||
| > The dsh is provided from the csm.dsh package which is available since > AIX 5.3 ( Maybe even AIX 5.2 ) and i believe its even installed by > default. > > cheers > Hajo But it will still need configuring even if the fileset is installed ! |
| |||
| invincible schrieb: > On Apr 22, 4:33 pm, Mark Taylor <m...@talk21.com> wrote: >>> But it will still need configuring even if the fileset is installed ! >> and do we even know what level of code the OP is running was my >> point ... > > It's AIX 5.3 ML4 But we still don't know what type or error you get. So all I can do is guessing. Maybe -n Specifies that the rsh command should not read from standard input. is the option you are missing. The rsh line then will be rsh $line -n cat /home/basks.tbl|awk '{ print $1 }' >>test.out |
| ||||
| One thing that you should be aware of when using either dsh, or rsh is where your variables are getting interpreted, and where your commands are actually being run. For example, In your original example: rsh $line cat /home/basks.tbl|awk '{ print $1 }' >>test.out The cat is done on the remote node, the awk is done on the local node. The entire /home/basks.tbl is being sent across the network. What Mark had suggested is better, in a way... rsh ${host} "awk '{print $1}' /home/basks.tbl" The awk runs on the remote node, but the "$1" gets interpreted by the local shell, and is replaced with a blank. This would mean that the whole file would be returned. (To check the interpretations, use set -x and try the command individually) This would work better: rsh ${host} "awk '{print \$1}' /home/basks.tbl" Not understanding where the commands are being executed, and how the variables are interpreted will cause confusion about your data returned, but it won't cause the rsh to fail. So, as Thomas has hinted, more information about what is actually failing will probably give you more help on how to fix it. Hope this Helps --Casey |