Script::RemoteExceute Your Scripts Over SSH (And Pass Data Along) | |
Download |
Script::Remote Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Daisuke Maki
- Publisher web site:
- http://search.cpan.org/~dmaki/
Script::Remote Tags
Script::Remote Description
Exceute Your Scripts Over SSH (And Pass Data Along) This is a stupid little hack that makes running scripts remotely a *bit* easier.Please note that this is full of potential security gotchas. We generate code on the fly. This is bad. We're basically doing a remote eval(), which is just bad bad bad. DO NOT USE THIS MODULE if you expect people with no or minimal knowledge about how this kind of distributed system hacks work.Having said that, for tests, this could be handy. All you need is a ssh-enabled set of machines (you probably want public key auth, too), and two scripts: the script you want to run remotely, and a script that will drive those script(s).To run a single script on a single remote machine, simply say: use Script::Remote; Script::Remote->new( script => 'foo.pl', hostname => 'my.host.name' )->run();If you want to run the same script on multiple hosts, you need to tell Script::Remote to not block on wait(), so you need to use the no_wait parameter: my $script = 'foo.pl'; my @scripts; my $data = ...; # some shared data foreach my $host (@hosts) { my $remote = Script::Remote->new( script => $script, hostname => $host, no_wait => 1, ); $remote->run(data => $data); push @scripts, $remote; } $_->wait_child for @scripts;SYNOPSIS # CASE 1: Simple case # Write a script first (say, foo.pl) use strict; print "Hello, World!\n"; # Elesewhere, in a different file use Script::Remote; my $remote = Script::Remote->new( script => 'foo.pl', hostname => 'some.host.com', ); $remote->run; #### CASE 2: With Data #### use strict; print "Hello, World from $config->{myname}\n"; $remote->run( variable => 'config', data => { myname => "Daisuke Maki" }, ); Requirements: · Perl
Script::Remote Related Software