parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamically changing remote servers list


From: Douglas A. Augusto
Subject: Re: Dynamically changing remote servers list
Date: Tue, 26 Aug 2014 18:42:45 -0300
User-agent: Mutt/1.5.23 (2014-03-12)

On 25/08/2014 at 21:41,
Ole Tange <ole@tange.dk> wrote:

> Great. I think it will make sense to expand the section on --sshloginfile.

Hi,

You have already updated the man file, describing how to keep the server list
up-to-date. Thanks! 

I'd like, though, to propose some modifications to the script. Here is the
modified script:

   cat original.slf > updated.slf
   while [ 1 ] ; do
      nice parallel --timeout 10 --nonall -j0 -k --slf original.slf --tag echo 
| sed -e 's/\t$//' -e '/\t/d' > tmp.slf
      if ! cmp -s tmp.slf updated.slf; then
         cat tmp.slf > updated.slf
      fi
      sleep 10
   done
   parallel --slf updated.slf ...


Some explanation:

   - Changed 'perl' to 'sed' (the former didn't work)

   - Added pattern '/\t/d' to remove spurious lines such as (when ssh echoes 
some error message):
       server.net       /usr/bin/xauth:  error in locking authority file ...

   - 'cmp' instead of 'diff' because it is faster (and silent!)

   - '--timeout 10' to make the script more robust (for instance, killing ssh 
attempts to servers that ask for password)

   - 'cat' instead of 'mv' to prevent changing the file descriptor (I'm not 
sure if this affects the way GNU Parallel handles file updates)

-- 
Douglas A. Augusto



reply via email to

[Prev in Thread] Current Thread [Next in Thread]