System("ssh user@remotemachine perl "); will run the script on remote machine. You may want to ssh without password, check: linuxproblem.org/art_9.html.
1 +1, thanks for posting an answer. So, Perl's System() does not allow you to store the password in the script, right? And your suggested work around is to create and store authentication keys outside of the perl script in this case using OpenSSH, right?
– blunders Feb 17 '11 at 15:11 2 ssh doesn't have an option to specify password as a parameter, it doesn't have anything to do with system() – Nylon Smile Feb 17 '11 at 15:41 +1 Great, thanks -- that's what I needed to know. – blunders Feb 17 '11 at 15:50 @All: The docs on system() are here perldoc.perl.org/functions/system.html – blunders Feb 17 '11 at 18:15.
As @Nylon Smile mentioned, you can use system to invoke the system's ssh client. If you want to do this without relying on external binaries (in particular because you want to handle password authentication differently), try Net::SSH::Perl, available from CPAN. Use Net::SSH::Perl; my $ssh = Net::SSH::Perl->new('host'); $ssh->login('username', 'password'); my ($stdout, $stderr, $exit_code) = $ssh->cmd( 'perl some_script.
Pl --with=some_args', 'optionally, some stdin for that script' ); Net::SSH::Perl can be a bit of a pain to install, but there are several other CPAN modules (most of which rely on an installed OpenSSH) and are a bit easier to deal with while providing a similar api. See also Net::SSH and Net::OpenSSH.
1 +1 Thanks, I'd seen those, but it was not clear to me why; eg ssh does not have a password parameter. – blunders Feb 17 '11 at 16:02.
The above answers are fine for a one-off, but if you're doing this sort of thing a lot, you may want to look into some sort of messaging system like AMPQ (e.g. RabbitMQ) and set up queue listeners.
– blunders Feb 17 '11 at 18:00 Well, reason #1 would be if you do it a lot in general. Other reasons include if you have more than one "kind" of thing being done (for instance, running a program or script, changing a config, adding data to a database, logging, etc) it can be very useful to have a simple way to go about all these things in one apparent location. The basic idea is to set up listeners on the machines/vms involved that poll the queue for instructions to them, and then any process that needs to ask another machine to do something just drops a JSON, XML, or whatever message into the queue.
– Dodger Feb 17 '11 at 18:10.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.