The system looks through the directories in PATH
to find executables if you don't specify the full path. As such this is almost certainly because the PATH
variable used by cron does not include /usr/local/bin/
.
It's also possible that the utility is a script, and is not specifying the full path to its interpreter on the first (#!
) line. If the path to this interpreter is in your PATH
when logged in, but not in cron's PATH
then you'd get a similar issue.
Generally speaking it's considered good practice to always use the full path in scripts to be run from cron, as cron may well have a different setting for PATH
to you. The alternative is to call your script from cron as /full/location/of/script
, and set a new value for PATH
in the script.
We get this issue pop up a lot on FreeBSD because cron does not search under /usr/local
by default, whereas most (if not all?) Linux distributions do.