RHEL6
In root's crontab a have:
* 21 * * * /root/script.sh
In script.sh there is a line:
/usr/bin/sudo -u jira bash -c 'cd /opt/jira/bin; ./stop-jira.sh' && echo "Jira Shut Down" >> /root/debuglog
The command executes in a regular shell but not when run from cron.
The cron process works fine and the rest of the script executes correctly, it's just the sudo part that doesn't work.
I have updated the script: swapping out sudo for su and tested in another script and it seems to work. I'll test on the actual script tonight and update this post then.
The sudo
to su
change corrected the issue.
Thanks