I have a crontab script which runs fine from the interactive shell. However when running from crontab it fails because it doesnt run the scripts in /etc/profile.d/ (e.g. /etc/profile.d/java.sh)
Whats the best way of fixing this?
begin the shell script with:
This causes bash to start as a login shell, which means it will read /etc/profile and ~/.bash_profile.
Set SHELL on your crontab:
SHELL=/bin/bash * * * * * # your_job