I am on shared hosting and I'm trying to schedule cronjob to run every now and then. Via cPanel I scheduled to execute my script but even though that according to my host support the cronjob runs, the script doesn't seem as doing anything. The cron job command I set via cPanel is:

/bin/sh /home1/myusername/public_html/somefolder/cronjob2.sh

and the cronjob2.sh

/home1/myusername/public_html/somefolder/node_modules/forever/bin/forever stop 0

when via SSH I execute:


it stops forever process as needed. From cronjob doesn't do anything.

How can I get this working?


So I've tried:

/bin/sh /home1/username/public_html/somefolder/cronjob2.sh >> /tmp/mylog 2>&1

and mylog entries say:

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

It seems that forever needs to run node and this cannot be found. How would I possibly fix this?

  • It should do it, but I want to ask to you: does it stop forever process even if you execute the script with `/bin/sh /home1/myusername/public_html/somefolder/cronjob2.sh'?
    – Hastur
    Jun 3, 2014 at 22:36
  • if I execute script `/bin/sh /home1/myusername/public_html/somefolder/cronjob2.sh' it does work. I also updated my answer
    – spirytus
    Jun 4, 2014 at 0:20

1 Answer 1


You may need to define your PATH and other environment variables at the start of your script. Type "set" to show their values in your current shell, then copy/paste whatever you need, adding lines until your script works.

You must log in to answer this question.

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