开发者

How to run a Cron job for Node.js

I have a cron job that call a shell script.

*/2 * * * * sh cron_test.sh >> output.log

In side the shell script, I run some command lines like:

#!/usr/bin

./mongo/bin/mongodump .....

FILE_NAME='abc'

node mynode.js $FILENAME

It runs if I just call cron_test.sh in command prompt. However, it doesn't run node if it is run by cronjob. It does run the mongodump command. So, what's wrong? is there anything I have to set for开发者_如何学C permission, etc?


thanks.. I find it out..

either I need to specify the node path or do that in the sh script:

nodejs/node myscript.js

where nodejs/node is where the node installed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜