Thursday, 15 September 2011

linux - bash script while loop -


Hello I'm new in bass scripting. This is my script which I am using, while this loop server ping the IP in the file Is working on providing input, but I want to use those IPs so that I can do the files of each of the following given below, but I think there is some problem with it if there is more loop in it. But it is not working only takes one IP in the form of input and can only create a file and adding it to the required file which is not working on the whole input, it is to say that the file is 5 ips It only creates the first IP file.

  #! / Bin / bash l2 = $ (tail1 / root / server file | grep hasoop | tr '' '\ n' | grep hasoop) awk '{print $ 1}' & lt; ServerFile.txt | While reading IP; If Ping-C1 $ ip & gt; / Dev / null 2 ​​& gt; and 1; Then CD / USR / Local / Negies / etc / Object / Hadoop CP Hadoop-node.cfg $ l2.cfg sed -i '/ 192.168.0.1 /' $ ip '/' $ l2.cfg sed -i '/ Hadoop -Node / '$ l2' / '$ l2.cfg resonance' cfg_file = / usr / local / nagios / etc / objects / hadoop / $ l2.cfg ">  
< / Div> P>

No comments:

Post a Comment