Search code examples
node.jsshellcronvps

Cron task not running


i've configure a cron task for running a NodeJS script everyday.

crontab -l

crontab

But my script is never executed (the script write data on a file, and the last modification time of this file is never updated.) When I run the script manually, it's working.

I've no idea why it's not working


Solution

  • Try putting the full path of your node binary. If you can't find it run the following:

    whereis node
    

    That should give you something like:

    /usr/bin/node

    In this example, your crontab line would look like this:

    55 23 * * * /usr/bin/node /getGames/

    Also be wary that this will differ depending on how you installed node.