Hello,

Recently I have had to update a router interface speed check script to work with the newer Cisco CRS routers that run XR instead of IOS. The only way I could get the script to connect to the routers at all was to utilize the Nett::OpenSHH module. Unfortunately it was not available via "yum update". Instead I downloaded the compressed file and manually installed (MAKE) the Module.

I can manually run the script without issuse or error. However, when the cronjob attempted to run it spits out and error (see below). I searched this site and others and the only recommendation I have found so far was to ensure "perl -mcpan" (?) showed is as properly installed. If have done this and it claimed that the module it "up to date".

Can anyone assist in getting this module to be recognized when cron is attempting to run the script.

Relevant Inforamtion:
=================================================
<removed> ~# uname -a
Linux <removed> 2.6.41.4-1.fc15.x86_64 #1 SMP Tue Nov 29 11:53:48 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
<removed> ~#
=================================================

=================================================
CRON Error:

Can't locate Net/OpenSSH.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .)
at /root/scripts/weathermap_check.pl line 8.
BEGIN failed--compilation aborted at /root/scripts/weathermap_check.pl line 8.
=================================================

=================================================
Begining of code and call:
#!/usr/local/perl -w #set modules to use use Net::Ping; use Net::SSH::Perl; use Net::OpenSSH; use Net::SMTP; use DBI; $ENV{'MYSQL_UNIX_PORT'} = '/tmp/mysql.sock'; $ssh = Net::OpenSSH->new("$hostnames[$testcount]", user => $username, +password => $password, master_stderr_discard => 1) || warn("\$!\n"); $out = $ssh -> capture ("show interfaces $interface[$routercom] | incl +ude BW"); print LOGONE $out; close (LOGONE);
=================================================


UPDATE: The issue has been resolved by copying the OpenSSH.pm file and its associated folder from the suers perl directory into the system perl installation. Thanks to everyone for their assistance. As always the monks here rule.


In reply to CRON job failing but manual run works by Dranzaz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.