Igor Ganapolsky Igor Ganapolsky - 10 months ago 54
Node.js Question

Node.js script not executing from crontab

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,


Try making a script with the command:


#!/usr/bin/env sh
node /home/campaigns/reporting/UNIT_TESTS/testCron.js > /home/campaigns/reporting/UNIT_TESTS/cron.log

and then adding that to cron:

*/5 * * * * /path/to/script.sh

make sure to make the script executable (chmod +x script.sh)