I have two scripts that both need to decrypt passwords using gpg-agent. Both of them run fine when launched from the terminal. The problem is that when run via cron, they both fail with these messages:gpg: problem with the agent: End of filegpg: decryption failed: No secret keyI have this in /etc/profile.d/gpg-agent.sh:if [ $EUID -ne 0 ] ; then    envfile=$HOME/.gnupg/gpg-agent.env    if [[ -e $envfile ]] && kill -0 $(grep GPG_AGENT_INFO $envfile | cut -d: -f 2) 2>/dev/null; then        eval $(cat $envfile)    else        eval $(gpg-agent --daemon --enable-ssh-support --write-env-file $envfile)    fi    export GPG_AGENT_INFO  # the env file does not contain the export statement    export SSH_AUTH_SOCK   # enable gpg-agent for sshfiAnd I can verify the agent is running:% pgrep gpg-agent510The cron tasks are in my own crontab. I've tried executing the scripts like this:*/30 * * * * source /home/user/.gnupg/gpg-agent.env && export GPG_AGENT_INFO && /scriptBut nothing I've tried works.
Using gpg-agent to decrypt password in cron job
cron;gpg;gpg agent