-
Notifications
You must be signed in to change notification settings - Fork 4
What is npp_watcher
npp_watcher
is a simple Node++ health checker.
We all care about our websites' reputation, and we want to make sure they're online always. Even expensive, reputable applications crash sometimes, or get killed by the system. We may be on a vacation on some remote island, enjoying our time away from the screen. When our web app is for whatever reason dead, we want it to be gracefully restarted. npp_watcher
comes to the rescue.
Login as root, edit crontab (crontab -e
) and add the command below:
NPP_DIR=<your NPP_DIR>
#-----------------------------------------------------------------------------
# min hour day month weekday command
#-----------------------------------------------------------------------------
# Node++ Watcher
0,30 * * * * $NPP_DIR/bin/npp_watcher
This way npp_watcher will make an HTTP request every half an hour on the local HTTP port defined in npp.conf (or 80 if not defined). If it can't connect and get valid HTTP response in 60 seconds, Node++ will be restarted.
There are a couple of parameters affecting npp_watcher that you can add to npp.conf:
Parameter | Description | Default |
---|---|---|
watcherLogLevel | Log level | 0 |
watcherLogToStdout | Log to stdout | 0 |
watcherLogRestart | Log level if restart is performed | 3 |
watcherStartCmd | Start command | $NPP_DIR/bin/nppstart |
watcherStopCmd | Stop command | $NPP_DIR/bin/nppstop |
watcherWait | Wait between stop and start (in seconds) | 10 |