[Q]: failed to decrypt if run from cron.
Gerik
fgerik@pc.jaring.my
Wed Aug 22 09:27:02 2001
thanks frank for replying.
>First, since you're running in cron, you should make sure interactive mode
>is false: $gnupg->options->interactive(0)
done, i've put $gnupg->options->meta_interactive(0)
>Second, you should use "direct" mode for your input file, since you're
>reading manually from a IO::Handle() anyways.
i got error :
% ./test.pl
error determining fileno for IO::Handle=GLOB(0xd2e18): at
/usr/local/lib/perl5/
site_perl/5.005/GnuPG/Interface.pm line 363.
%
script is as attached.
any suggestion ? i'm not a regular perl programmer, just when i have to.
or somebody with working script or example please ?
thanks,
--fg.
-------------- ny script, start --------------
#!/usr/local/bin/perl
use IO::Handle;
use IO::File;
use GnuPG::Interface;
$datadir = "/data";
$output_file = "./of";
$input_file = "./if";
$passphrase = "MyPassword";
$gnupg = GnuPG::Interface->new();
$gnupg->options->meta_interactive(0);
chdir "$datadir" or die "Can't cd to data dir : $datadir \n";
&decrypt_input_file;
sub decrypt_input_file {
$input = IO::Handle->new();
$output = IO::File->new( ">$output_file");
$errfile = IO::File->new( ">>$TEMP_STDERR");
$passphrase_fh = IO::Handle->new();
$handles = GnuPG::Handles->new(stdin=>$input,
stdout=>$output,stderr=>$errfile, passphrase=>$passphrase_fh);
$handles->options( 'stdout' )->{direct} = 1;
$handles->options( 'stderr' )->{direct} = 1;
# when i put below line as suggested, i got error metioned above.
$handles->options( 'stdin' )->{direct} = 1;
$cipher_file = IO::File->new("<$input_file");
$pid = $gnupg->decrypt(handles=>$handles);
print $passphrase_fh $passphrase;
close $passphrase_fh;
print $input $_ while <$cipher_file>;
close $input;
close $cipher_file;
close $errfile;
waitpid $pid, 0;
close $output;
return (1);
}
-----------end ---------------------
Frank Tobin wrote:
> Gerik, at 11:09 +0100 on Tue, 21 Aug 2001, wrote:
>
> hi,
> i have a perl script which successfully decrypt a file except when
> executed from cron where i would only get a blank file.
> i'm using GnuPG::Interface. I'm puzzled of where to fix.
> the script is as below.
> any input is greatly appreciated.
>
> First, since you're running in cron, you should make sure interactive mode
> is false: $gnupg->options->interactive(0)
>
> Second, you should use "direct" mode for your input file, since you're
> reading manually from a IO::Handle() anyways.
>
> See if cron is reporting anything going wrong, too.
>
> --
> Frank Tobin http://www.neverending.org/~ftobin/
>
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users@gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-users