Node and crontab not working properly

I am trying to run a node script using crontab, but it does not work 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 results in an empty string , although this should not be.

When I run node /home/me/path/to/script.js > /home/me/path/to/output , though, manually, everything is going well.

Could you help me with this?

+4
source share
1 answer

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

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

The value usually has the value /usr/bin/node .

+3
source

All Articles