Beast wrote:
>
> Hi all,
Hello,
> I have problem in perl script when executing external bash script using
> backtick.
>
>
> pscript.pl:
>
> my $resultt = &execute();
>
> print "RES: $result\n";
>
>
> sub execute() {
> my $ret = `/tmp/ping_yahoo.sh`;
You do realise that putting executable scripts in /tmp is a huge security risk?
> return $ret || "";
>
> }
>
>
> When run using cmmondline, it works (gives the correct output), but when
> scheduled using cron results is null/blank.
cron has a very limited environment so it's not surprising that the results
are different.
> If try to redirect the stderr and stdout also, no luck.
>
> my $ret = `/tmp/ping_yahoo.sh 2>&1`;
Have you thought about using Net::Ping in perl?
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>