Hello, I have setup a node.js app, not the default - although I tried that and learned a few things first. I have the whole application working when I go to the correct folder and run " Why does my app stop working after a while and is it required that I have a cron setup to start my app again? Further more. I tried to read the documentation on setting up the cron and it says right in the documentation:
Does this mean that even if I tried to setup a cron, I couldn't get my " Cheers asked 25 Feb '15, 01:00 longandshort |
The problem is that you're running the node server in your current session. When you terminate that session, it dies. The documentation about cron not knowing about your environment variables is also correct. However, no - despite this, a script which runs from cron is exactly what you need. Call that script every 10 minutes or so. If your application isn't running, it will be started; otherwise, the script exits without doing anything. More importantly, your environment variables would be set directly in that script, so it doesn't matter that cron doesn't know about them. All cron needs to do is to call the script, and all the script needs to do is to correctly start your application when needed. Hope that helps! answered 25 Feb '15, 01:30 ryans ♦♦ Thanks so much. I'll get started trying to modify the "start" script file that came with the basic OneCLick Node.js install from the webfaction dashboard system.
(25 Feb '15, 06:08)
longandshort
Is this all I need for a script? First time bash scripter:
the
(25 Feb '15, 07:07)
longandshort
Yes, that may be simple enough. The way to test is try running the script a few times, and then check your process listing with:
What you want to see is that only one instance of node is running, even though you ran the script several times. If you run it five times and end up with five (broken) node instances running in memory, then that's a problem, and you'll want to use the more intelligent watchdog script linked earlier. Hope that helps!
(25 Feb '15, 09:13)
ryans ♦♦
|