in reply to Re: Re: Re: Cron, Shell Script, and Perl
in thread Cron, Shell Script, and Perl

Hum. I don't believe that pgp will actually allow a person to pull the pass phrase from a file due to security reasons. But I am trying to automate the process and expect is the only way that I have found out how. As I said before the script runs fine as long as I run it manually. what if i just setup a timer to print the pass phrase without expecting something. Something like:
sleep(10); print "pass phrase goes here\r";
would something like that work in theory?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Cron, Shell Script, and Perl
by zigdon (Deacon) on Oct 07, 2002 at 16:43 UTC
    I doubt it. You'll be printing out to the STDOUT of your script, which has little to do with the STDIN of the pgp process, even assuming that it will let you. And I'm guessing that pgp will not even ask the question, as it has no controlling TTY to begin with. I guess there has to be a way to fake one, but I don't know how.

    -- Dan

      The following code worked and is now implemented via a cron job. The problem came about when it was actually waiting for expect to find the text. Instead of waiting for it to find it I knew that it would only take a second or two for it to ask for the password so I just set the timer to 10 seconds and it works. File decrypted successfuly.
      # Start the pgp decrypt process. ($decrypt = Expect->spawn("pgp $pgpfile")) || die "Couldn't spawn pgp +decrypt, $!"; # Wait for 10 seconds then post the password. sleep(10); print $decrypt "pass phrase goes here\r"; if(-e $outfile){ $message="$pgpfile decrypted successfully to $outfile."; } else{ $message="$pgpfile NOT decrypted to $outfile!"; } sleep(5); system("mv $pgpfile archive/");
      Thanx for the help.