Since the system crontab runs commands as root, it might be helpful to have the home directory HOME set to /root rather than /. Reproducible: Always Steps to Reproduce: 1. add mail.sh to cron.daily directory #!/bin/bash echo "this won't mail because it won't use gpg keys root has installed" | /usr/bin/gpg -ear nobody@nobody.com | /bin/mail -s "body comes out blank" example@example.com 2. When vixie cron runs the script the message sent will be blank 3. Expected Results: if HOME=/root in /etc/crontab then gpg will encrypt the email correctly.
Hrm, no-one else seems to do this. Don't think it's a good idea to break with tradition when there's such an easy workaround for scripts/