Tuesday, May 19, 2009

gpg crontab

1. executing in crontab provides a different set of environment variables, so the --homedir is needed to specify which keyring to use. In the example below, we use root's keyring.
2. --batch is necessary for crontabs because it tells gpg there is no user to interact with
3. 2>&1 is useful because it redirects stderr to stdout so you can better debug any errors you may be having
4. -d is for decrypt. in this case we are decrypting on a cron job

/usr/bin/gpg --batch --homedir /root/.gnupg --passphrase mypassphrase -o /home/output.csv -d /home/input.csv.gpg 2>&1

No comments: