I have a cron job I need to run as root and that needs bash rather than the default sh shell.
root crontab has other jobs in it that run fine as they are and I'd rather not risk breaking those by specifying
SHELL=/bin/bash at the top of the
How can I specify my cron job is to be run using bash without changing the shell used for other existing jobs?
I'm kind of thinking that a line like
0 * * * * SHELL=/bin/bash myjob might do the trick, but I can't find that mentioned anywhere in the CentOS documentation for cron.
I also thought that maybe setting the SHELL variable immediately before my job (which would be the last one in the file) might work, but couldn't find an documentation of the effect of placement of environment variables and whether they were assigned in document order or were just considered global regardless of their position (or perhaps generated an error if not before all jobs).
Is it possible for me to specify the shell on a job-by-job basis?