I have a crontab entry that is supposed to execute a node.js script like this:
*/5 * * * * node /home/campaigns/reporting/UNIT_TESTS/testCron.js > /home/campaigns/reporting/UNIT_TESTS/cron.log
However, it doesn't execute and the log file isn't updated. When I run the script manually, everything works though. Any ideas??
Thank you, Igor
I also had this problem. Seems that after system update on our server the link to node binary is gone from PATH
. Therefore the best solution in this case is always use not node script.js
, but full path to binary which in our case is /usr/local/bin/node script.js
.
I recently ran in to this same problem and was able to solve it with the help of the below blog post.
Essentially, put the full path to node and your file in the cron job:
/usr/local/bin/node /var/www/coffee.js
http://www.themechanism.com/voice/2012/08/28/getting-node-js-and-cron-to-play-nicely/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With