kanwisch has asked for the wisdom of the Perl Monks concerning the following question:
I've got a script, which I've copied below, that does an encryption of a file with 0.09 GnuPG Perl module, 1.06 GnuPG, egd-0.8, HP-UX 11.0, Perl 5.6.1.
What I'm seeing in the logs is that when the script reaches the file encryption line (not instantiation), it stops (issuing NO errors), and restarts from the top of the Perl script all by itself! The second time it arrives at the file encryption line, it works fine and moves on. I know its doing this repeating by use of a log, and it only happens when I redirect the output and error stuff to files. When run from the command line and letting it spit out to the screen, it runs absolutely as I'd expect (no restarting observed).
Anyone see anything like this before? Thoughts on where/how to troubleshoot what the cause could be? I know it doesn't occur w/ other Perl scripts, just the one that uses GnuPG and its associated module, but how can I tell if this's from the GnuPG module or the application (or something else entirely)?
#! /usr/local/perl/bin/perl -w #use strict; use GnuPG ; use Net::SMTP; use DBI; $gsDSN="dev"; $gsPassPhrase="passphrase"; $gsLogPath = "/home/autopca/ecomoper"; $gsRecipient = "RECIPIENT"; my (@gsaFields,$gsPLine,$gsALine,$gsHeader,$gsWriteLog,$gsOnlyAcctID,$ +gsAccount_EFile2); my ($gsPayment_File, $gsAccount_File, $gsAccount_Encrypted, $gsWhich_F +ile,$gDBI); my $gsPath = "$gsLogPath/ecom/scripts/"; $gsLogPath .= "/ecom/tmp/"; #*******Call subs********** print "Beginning send.pl.\n"; print "******************************"; print "Beginning Payment processing.\n"; &ReadPaymentFile; #********************************************************************* +************************** # ReadPaymentFile #********************************************************************* +************************** #This sub reads the payment file written by Oracle and call GPG functi +on sub ReadPaymentFile { my (@saLine,$iCount,$iPos,$sVlu,$iPos2,$saLine); #open the proper file $gsPayment_File = $gsPath . "clear.txt"; $gsPLine= ""; if (!(open (INI, "$gsPayment_File"))) { print "Payment file error: $gsPayment_File not open:$!\n"; exit(1); } #Assign the file's contents to saLine @saLine = <INI>; close (INI); $iCount=0; #Loop through the lines of the file parsing out what we want foreach $saLine (@saLine) { chomp $saLine; if (!(length($saLine) == 80)){ print "not 80 byte:". $saLine; } $gsPLine .= $saLine."\n"; } $gsWriteLog = "Start with Payment : Sent to PGpg. "; print "Payment file read.\n"; PGpg($gsPayment_File); } #********************************************************************* +********************** # PGpg #********************************************************************* +********************** #This sub sign and encrypt payment file and call ftp function sub PGpg { my ($sFile_Name) = @_; my ($gpg); if ($gsDSN ne "dev") { #Production/QA gpg setup $gpg = new GnuPG (Homedir => "~/.gnupg", trace => $ENV{TRACING +}, gnupg_path=>"/usr/local/gnupg/bin/gpg" ); } else { #Development gpg setup $gpg = new GnuPG (Homedir => "~/.gnupg", trace => $ENV{TRACING +}, gnupg_path=>"/usr/bin/gpg" ); } if ($sFile_Name =~ /clear.txt/) { $gsWhich_File = $gsPath ."cipher.txt"; print "Encrypting payment file $sFile_Name with key $gsRecipie +nt.\n"; eval {$gpg -> encrypt ( recipient => $gsRecipient, output => $gsWhich_File, armor => 1, plaintext => $sFile_Name, sign => 1, "local-user" => FF743118, passphrase => $gsPassPhrase, ); }; if ($@) { print "Errors from gpg encryption of payment file:$@\n +"; exit(1); } print "Payment PGP Done. Start Transferring payment input file + ($gsWhich_File).\n"; } } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: GnuPG and auto script restart
by derby (Abbot) on May 01, 2002 at 19:24 UTC | |
by kanwisch (Sexton) on Aug 08, 2002 at 18:19 UTC |