Thanks a ton Jeff. It works. Thanks, harsha
Jeff Pang <[EMAIL PROTECTED]> 08/27/2008 12:52 AM Please respond to Jeff Pang <[EMAIL PROTECTED]> From Jeff Pang <[EMAIL PROTECTED]> To "Perl Beginners [Beginners Perl]" <beginners@perl.org> cc Subject Re:perl script on remote server linux Try the code below, wish it works fine for you. open FILE, "server_list.txt" or die $!; while(<FILE>) { print "the host is: $_"; chomp; system "ssh -x -t $_ \"sudo /home/tadipah/test.sh\" "; } close FILE; --Jeff > Message du 27/08/08 06:33 > De : [EMAIL PROTECTED] > A : beginners@perl.org > Copie à : > Objet : perl script on remote server linux > > I am trying to execute a perl script from source A to invoke another > script on 5 remote servers. The script is as follows: > > #!/usr/bin/perl > > open file, "server_list.txt"; > @content = ; > $tot=$#content+1; > print "$tot \n"; > > while ($tot > 0) > { > $m = shift @content; > print "$m \n"; > `ssh -x -t $m "sudo /home/tadipah/test.sh"` ; > sleep 5; > exit > } > Server_list above has the list of servers the script needs to be executed > on. > Above script works fine until it connects to the server and asks me the > password. After I type the password, the putty sessions freezes. > > When I use the line below alone without the while or foreach loop, it > works absolutely fine and returns me the output of the script test.sh from > remote computer. > `ssh -x -t SERVERNAME "sudo /home/tadipah/test.sh"` ; > > Any help is appreciated. Créez votre adresse électronique [EMAIL PROTECTED] 1 Go d'espace de stockage, anti-spam et anti-virus intégrés.