Debian – What shell is used by cron

crondebian

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?

Best Answer

You can put SHELL=/bin/bash in your crontab - you can also point to a .bashrc using BASH_ENV="/root/.bashrc". That should get you going. I actually don't know what happens if you don't have SHELL defined, but adding it to crontab makes it easy to tell what is what.

Related Topic