I have a cron job that is running a script. When I run the script via an interactive shell (ssh'ed to bash) it works fine. When the script runs by itself via cron it fails.
My guess is that it is using some of the environmental variables set in the interactive shell. I'm going to troubleshoot the script and remove these.
After I make changes, I know I could queue up the script in cron to have it run as it would normally, but is there a way I can run the script from the command line, but tell it to run as it would from cron - i.e. in a non-interactive environment?
unset
.env
, and you might want to tryenv -i ./my-script.sh
. Also, are you getting an error message?