in reply to Re: Is SSH the only way to execute remote, one off PERL scripts?
in thread Is SSH the only way to execute remote, one off PERL scripts?

Thanks everyone for the replies.

A quick update:

I was indeed doing something wrong. I was printing out error and status messages for each step in my parsing loops. For a big scrape job like the one I'm in the midst of, this could be hundreds of thousands of lines which was causing Terminal to chew up RAM.

So, I've commented out all but a couple critical lines and immediate symptom solved.

However, I think the nohup suggestion will actually solve the problem. Not having to keep a terminal window and SSH session open after executing a script sounds like a dream!

Thanks again!
  • Comment on Re^2: Is SSH the only way to execute remote, one off PERL scripts?

Replies are listed 'Best First'.
Re^3: Is SSH the only way to execute remote, one off PERL scripts?
by Khen1950fx (Canon) on Jul 25, 2010 at 01:16 UTC

    I'm glad that you found a solution. I had been working on this before you made your post. I thought that I'd post it just in case it gives you some ideas.

    I used Parallel::Runner to run 5 scrapers

    #!/usr/bin/perl use strict; use warnings; use Parallel::Runner; open STDOUT, '>', 'ssh.log' or die "Couldn't open ssh.log: $!\n"; my $runner = Parallel::Runner->new(5); $runner->run( sub { system("perl scraper1.pl") }); $runner->run( sub { system("perl scraper2.pl") }); $runner->run( sub { system("perl scraper3.pl") }); $runner->run( sub { system("perl scraper4.pl") }); $runner->run( sub { system("perl scraper5.pl") }); $runner->finish;
    Then I used this to check the log
    #!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; connectToServer(); sub connectToServer { my $host = 'remote_server'; my $username = 'user'; my $password = 'password'; my $cmd = 'cat /path/to/ssh.log'; my $ssh = Net::SSH::Perl->new( $host, protocol => '2,1', debug => 1, ); $ssh->login( $username, $password ); my ( $stdout, $stderr, $exit ) = $ssh->cmd($cmd); print $stdout, "\n"; }