Execute Perl script on remote server from local machine

前端 未结 2 1008
情深已故
情深已故 2021-01-19 14:09

I am rather new to Perl and translating some bash scripts to parse Apache logs from several remote production servers into a more useful format for processing on a local mac

相关标签:
2条回答
  • 2021-01-19 14:44

    Net::SSH is ssh executable wrapper, and there are better solutions for perl nowadays.

    http://search.cpan.org/~remi/Net-SSH2-Simple/lib/Net/SSH2/Simple.pm#SYNOPSIS

    my ($stdout,$stderr, $exitcode) = $ssh2->cmd("perl -e $crawler") 
      or die $ssh2->error;
    
    0 讨论(0)
  • 2021-01-19 14:53

    If you're not passing arguments to the script, it should be as simple as

    ssh "user@host" perl < $crawler

    If you want to pass command line args, just use a "-" placeholder to get the same affect as the bash -s, i.e.

    ssh "user@host" 'perl - arg1 arg2' < $crawler

    0 讨论(0)
提交回复
热议问题