I have a script that works perfectly if I execute it from the command line manually. However, when it runs via cron, the job fails with the following error:

/usr/bin/env: escript: No such file or directory

The first line in the script is:

#!/usr/bin/env escript

The only thing I can figure is that escript is not being found, and that is because it is not installed in /usr/bin, but in a sub-directory of the user's home directory.

My understanding--perhaps misunderstanding--of cron is that cron runs each job in a user's crontab under the UID/GID of the user. Should it also not inherit the PATH variable from the user as well? Must everything be specified as absolute paths?

2 Answers 2


Cron runs under the UID of the user but with a minimal PATH. Your script needs to use a full path to the interpreter (escript) or you need to set the PATH in the crontab.


cron does not inherit the PATH from the users's interactive setup. PATH is set to "/usr/bin:/bin"

Ypu can set environment variables on the crontab line

See man crontab for the details e.g. man crontab

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .