I have a script that has a part that looks like that:
for file in `ls *.tar.gz`; do
echo encrypting $file
gpg --passphrase-file /home/$USER/.gnupg/backup-pas
You should make sure that GPG is in your path when the cronjob is running. Your best guess would be do get the full path of GPG (by doing which gpg
) and running it using the full path (for example /usr/bin/gpp...
).
Some other debugging tips:
$?
after running GPG (like this: echo "$?"). This gives you the exit code, which should be 0, if it succeded/usr/bin/gpg ... 2>&1 >> gpg.log
)