[CentOS] gpg command works fine from login shell, not from cron script

2009-10-19 Thread Sean Carolan
I have an odd situation here, maybe one of you can help.  We have a script that runs via a cron job.  It's purpose is to decrypt PGP-encrypted files in a certain directory.  I have tried the command two different ways, both fail with the same error message: gpg --decrypt $file

Re: [CentOS] gpg command works fine from login shell, not from cron script

2009-10-19 Thread Spiro Harvey
Sean Carolan scaro...@gmail.com wrote: Why does it say secret key not available? The output of gpg -K shows that the key is in fact available, and this is further confirmed when I run the script manually and the files are decrypted just fine. Is the cron job running as a different user? eg;

Re: [CentOS] gpg command works fine from login shell, not from cron script

2009-10-19 Thread Bill Campbell
On Mon, Oct 19, 2009, Sean Carolan wrote: I have an odd situation here, maybe one of you can help.  We have a script that runs via a cron job.  It's purpose is to decrypt PGP-encrypted files in a certain directory.  I have tried the command two different ways, both fail with the same error

Re: [CentOS] gpg command works fine from login shell, not from cron script

2009-10-19 Thread Sean Carolan
On Mon, Oct 19, 2009 at 2:41 PM, Spiro Harvey sp...@knossos.net.nz wrote: Is the cron job running as a different user? eg; are you running gpg as a non-privileged user and the cronjob as root? The cronjob script runs from /etc/crontab. Let me try root's personal crontab instead.

Re: [CentOS] gpg command works fine from login shell, not from cron script

2009-10-19 Thread Sean Carolan
Typically this type of problem is caused by environment variables that are set in a login shell, but are missing or different than those set for jobs running under cron. You nailed it, Bill. Running the cron from root's personal crontab worked fine. Must have been environment variable

Re: [CentOS] gpg command works fine from login shell, not from cron script

2009-10-19 Thread Bill Campbell
On Mon, Oct 19, 2009, Sean Carolan wrote: Typically this type of problem is caused by environment variables that are set in a login shell, but are missing or different than those set for jobs running under cron. You nailed it, Bill. Running the cron from root's personal crontab worked fine.