Got caught by this today. Cron jobs normally run /bin/sh, not /bin/bash. It's probably required POSIX behaviour.
Normally most commands run out of cron are not affected because they are not dependent on bash, or the shell script starts with #!/bin/bash. However commands like vncserver which start up desktops (e.g. with the @reboot time spec) can be sensitive to the shell used because of environment scripts in /etc/profile.d.
Therefore if you want to ensure that the cron job works the same whether run interactively or from a crontab, specify the shell. E.g.
@reboot SHELL=/bin/bash /usr/bin/vncserver ...
Normally most commands run out of cron are not affected because they are not dependent on bash, or the shell script starts with #!/bin/bash. However commands like vncserver which start up desktops (e.g. with the @reboot time spec) can be sensitive to the shell used because of environment scripts in /etc/profile.d.
Therefore if you want to ensure that the cron job works the same whether run interactively or from a crontab, specify the shell. E.g.
@reboot SHELL=/bin/bash /usr/bin/vncserver ...
No comments:
Post a Comment