>> parallel -a iplist.txt 'ssh -qtt {} "sudo whoami" </dev/null' >> parallel -a iplist.txt 'ssh -qtt {} "sudo whoami"' </dev/null >> cat iplist.txt | parallel 'ssh -qtt {} "sudo whoami"'
Thank you . I have a strange problem , if cat iplist.txt | parallel 'ssh -qtt {} "sudo /usr/sbin/userdel -rf abcuser " ' , it still freeze , but sudo other cmd will work well . sosogh From: Ole Tange Date: 2015-08-23 12:05 To: sosogh CC: parallel Subject: Re: use parallel for ssh -tt "xxxx" On Fri, Aug 21, 2015 at 4:01 AM, sosogh <sos...@mail.com> wrote: > without -tt in ssh ,everything goes well: > parallel -a iplist.txt ' ssh -q {} "whoami" ' > > but with -tt , parallel will not exit , it will freeze there when finishing > the last job. > parallel -a iplist.txt ' ssh -qtt {} "sudo whoami" ' > > why I need -tt is to work around "ssh sudo: sorry, you must have a tty to > run sudo". The work around is: parallel -a iplist.txt 'ssh -qtt {} "sudo whoami" </dev/null' parallel -a iplist.txt 'ssh -qtt {} "sudo whoami"' </dev/null cat iplist.txt | parallel 'ssh -qtt {} "sudo whoami"' The reason for your problems is due to the first job gets STDIN as its controlling tty (from man parallel): stdin (standard input) will be passed to the first process run. I seem to remember it was implemented to be compatible with some xargs situation. /Ole