Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node and crontab not working properly

I am trying to run an node script with crontab but its not working as I expected (Ubuntu 12.04). In my crontab file I got

*/1 * * * * node /home/me/path/to/script.js > /home/me/path/to/output

This produces empty string output while it shouldn't.

When I run node /home/me/path/to/script.js > /home/me/path/to/output though, manually, everything goes fine.

Could you help me out with that?

like image 592
Paris Avatar asked Oct 04 '22 13:10

Paris


1 Answers

Change node to what comes from which node. That is, put full path of the binary executing process.

*/1 * * * * /path/to/node /home/me/path/to/script.js > /home/me/path/to/output
#           ^^^^^^^^^^^^^

The value is normally something like /usr/bin/node.

like image 157
fedorqui 'SO stop harming' Avatar answered Oct 12 '22 19:10

fedorqui 'SO stop harming'