in reply to Cron, Shell Script, and Perl

A cron job does not have a tty or a login environment. You'll need to examine your code for assumptions about those. Are you getting email from cron about errors?

If you'd like to post code, we can give you a better idea of what may be breaking.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Cron, Shell Script, and Perl
by landonc (Novice) on Oct 07, 2002 at 16:23 UTC
    Here is the main part of code that is used with expect and where it is unable to actually expect the phrase:
    # Start the pgp decrypt process. ($decrypt = Expect->spawn("pgp $pgpfile")) || die "Couldn't spawn pgp +decrypt, $!"; # Check to see for the password prompt. If prompted then post the pas +sword. if($decrypt->expect(30,"Enter pass phrase: ")){ sleep(3); print $decrypt "pass phrase goes here\r"; }
      Instead of trying to capture the PGP output yourself, have you thought about using one of the PGP modules from the CPAN?

      JJ

        Thanx, I got it fixed using expect and then waiting to post the pass phrase.
      My guess is that pgp doesn't want to run without a terminal. I think I've seen it complain about not being able to ask for the passphrase. Isn't there an option in pgp to allow reading the passphrase from a filehandle? That would get around the lack of terminal, and probably get rid of Expect as a byproduct...

      -- Dan

        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?