I'm running my small node app on an Ubuntu server, I can use a simple Upstart script to automatically start the node server on server launch.
However, I'd like the node app to run at particular times of day -- what are my options for implementing this? Is it best to do this within the Node app or from the Ubuntu environment?
What about cron
?
$ crontab -e
# in the editor that opens:
0 */2 * * * ~/path/to/your/node/script.js > /tmp/out.log 2> /tmp/err.log
That will run your script.js
every 2 hours, ie 0:00 (midnight), 2:00, 4:00, etc. It also logs to your /tmp directory, but that's entirely optional.