Re:perl script on remote server linux
- From: pangj@xxxxxxxxxxx (Jeff Pang)
- Date: Wed, 27 Aug 2008 06:52:04 +0200 (CEST)
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 : TADIPAH@xxxxxxxxxxxxxx
A : beginners@xxxxxxxx
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 prenom.nom@xxxxxxxxxxx
1 Go d'espace de stockage, anti-spam et anti-virus intégrés.
- Follow-Ups:
- Re:perl script on remote server linux
- From: TADIPAH
- Re:perl script on remote server linux
- Prev by Date: perl script on remote server linux
- Next by Date: Re:perl script on remote server linux
- Previous by thread: perl script on remote server linux
- Next by thread: Re:perl script on remote server linux
- Index(es):
Relevant Pages
|