I have picked up a habit of including .
from some blog post:
0 0 * * * . /usr/local/bin/somescript.sh
...instead of:
0 0 * * * /usr/local/bin/somescript.sh
For instance a visual cron schedule expression editor cron.guru considers using the character as an error, but my scripts appear to have ran as specified at least until now.
crond
runs the command with a fairly arbitrary shell: nominally /bin/sh, which may be a link to another shell (like ksh), and may also be overridden by a SHELL directive in the crontab. Sourcing your command script means its own shebang gets ignored, and the default shell may not like the syntax. – Paul_Pedant Apr 12 '22 at 20:44.
" will malfunction if yoursource
d file is not a/bin/sh
compatible script. If it's an ELF binary or an incompatible script, BOOM! – waltinator Apr 13 '22 at 13:17/usr/local/bin
, they appear in$PATH
now. The question had a bad location. – user598527 Apr 14 '22 at 20:30