cron runs shell commands from crontabs.
But having just got caught out by the differences between zsh and bash, I'm now concerned that I don't know which shell cron uses to interpret crontab commands? Obviously the simple case where the cron entry just points to a script file is handled by the #!/path/to/interpreter
on the first line, but what when you have something more complex in cron?
I looked in /etc/cron*
and can't see anything that might allow this to be set or changed?
The crontab(5) manpage deals with your query by default it's
/bin/sh
so adding
to the crontab file would change the shell accordingly.
You can put
SHELL=/bin/bash
in yourcrontab
- you can also point to a.bashrc
usingBASH_ENV="/root/.bashrc"
. That should get you going. I actually don't know what happens if you don't haveSHELL
defined, but adding it tocrontab
makes it easy to tell what is what.