[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Way OT: openSSH 2.9.9p2, perl and cron SNAFU



Hi all,
this is way OT, but maybe someone can come up with an
explanation. Here's a snippet of perl I'm trying to run 
as a cron job:

open( IN, "$cmd |" );  # read output of $cmd via pipe
while( $line = <IN> ) {
    push @lines, $line; # store it in array
}
close( IN );
foreach $line (@lines) { print $line; } # print the array

When $cmd is, say "sar -u 1" (this is on Solaris), it works.
When $cmd = "rsh <host> sar -u 1", it works.
When $cmd = "ssh <host> sar -u 1", it works from command line.
If I run it as cron job, @lines is empty.

It works if $cmd = "ssh <host> echo FUBAR". 

So far I tried specifying full paths to executables, backticking
$cmd instead of piping it, adding stuff to %ENV (this shouldn't
be relevant anyway as rsh works with the same environment)... 
No go.

Any clues?

TIA
Dima
-- 
"Mirrors and copulation are abominable because they increase the number of 
entities."                                        -- corollary to Occam's Razor



Reply to: