I've written a small tool in C++, compiled it, made it executable, and move it to /opt/tools/bin. The latter is a directory I created to store small, custom programs. I export
it to $PATH
in my .zprofile, which let's me use tool
in a terminal, and the program runs fine.
However, when I try setting up a cron job to run tool
a couple of times a day, cron always complains about "/bin/sh: ./tool: No such file or directory".
I've tried both these cron commands with the same result:
0 8,12,16,20 * * * zhrdct >> /opt/tools/var/log/zhrdct.log 2>&1
0 8,12,16,20 * * * ./zhrdct >> /opt/tools/var/log/zhrdct.log 2>&1
What could be the issue here?
I know that I can probably use the absolute path to tool but if possible I'd like it work with the shorthand.
/bin/sh
, not/usr/bin/zsh
.