0

i've installed a python software that allows to run javascript on the server

i've put the binary file (jsrunner) in this address

/usr/local/bin/jsrunner

so in the ssh when i try it it works fine

/usr/local/bin/jsrunner /home/domain/public_html/test.js

and i get some output from test.js

so i've put the same exact command in the cronjob

* * * * * /usr/local/bin/jsrunner /home/domain/public_html/test.js

but after a while i didn't get the expected result so i've enabled email report on cronjob and i got a email with this title

Cron <domain@CentOS-67-64-minimal> /usr/local/bin/jsrunner /home/domain/public_html/test.js

containig this error

/bin/sh: /usr/local/bin/jsrunner: No such file or directory

why there is /bin/sh: at the beginning of commend ? why it fails to find the file when i run it from cronjob ?

pleas note my cronjob works fine for other files like php using curl or binary , it's only this particular software/bin file that cuzing this error

hretic
  • 111

1 Answers1

0

i've this working on my other servers it's just this new server is cuzing the error and only on cronjob

I had mostly the same issue but with inkscape binary. It works perfectly via apache but doesn't work via nginx. The root of the issue was environment variable PATH.

For example from cron

# crontab -l
* * * * * echo $PATH > /tmp/path.log

# cat /tmp/path.log
/usr/bin:/bin

From the console

# echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/nodejs/bin
ALex_hha
  • 7,415