I have a script job.sh in /home/user/scripts, which is then symlinked to /home/user/bin/job. The custom binaries path has been included in .bashrc, so whenever I issue the command job param1 etc from the cli everything works as expected.When said command has to be run through a cronjob, it doesn't. On the other hand, if the cronjob refers to the full path (/home/user/bin/job instead of simply job) everything runs fine.Any pointer on how to tackle this issue?
cron not working with commands symlinked in custom PATH
cron;symlink;path
cron intentionally runs with a limited environment (including a restricted path, it does not have the same path as your standard shell).You either need to run a script (including the full path to the script) which then sets a path variable internally, or you need to set the path in the crontab line itself.One example of that is,12 0 * * * (export PATH=$PATH:/somedirectory; job)Really though, it's safer to just include the full path to whatever you're running in the crontab, and set the path correctly in your scripts that cron executes.