From 5ba029217317fe2a4dce1ea224bff16ca0fcd419 Mon Sep 17 00:00:00 2001 From: curtisz Date: Wed, 7 Jan 2015 12:24:25 -0800 Subject: [PATCH 1/2] added: uptime init script, instructions in README, uptime-sns plugin link --- README.md | 6 +++++- uptime | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100755 uptime diff --git a/README.md b/README.md index b1c9cfa48..71814505e 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ Lastly, start the application with: $ node app ``` +Alternatively, a simple init script is provided. To install this init script, copy `uptime` from the project's root directory to your system's init script directory (for example `/etc/init.d/`). Make sure the file is executable (`sudo chmod +x /etc/init.d/uptime`) and owned by root (`sudo chown root:root /etc/init.d/uptime`). To start the uptime service on every boot, register the service with your particular init system and enable it. + Upgrading From a 2.0 Install ---------------------------- @@ -98,6 +100,7 @@ plugins: - ./plugins/console - ./plugins/patternMatcher - ./plugins/httpOptions + - ./plugins/basicAuth # - ./plugins/email ``` @@ -173,7 +176,8 @@ Third-party plugins: * [`webhooks`](https://github.com/mintbridge/uptime-webhooks): notify events to an URL by sending an HTTP POST request * [`campfire`](https://gist.github.com/dmathieu/5592418): notify events to Campfire - * [`pushover`](https://gist.github.com/xphyr/5994345): Notify events to mobile devices + * [`pushover`](https://gist.github.com/xphyr/5994345): notify events to mobile devices + * [`sns`](https://github.com/curtisz/uptime-sns-plugin): notify events to AWS SNS Writing Plugins --------------- diff --git a/uptime b/uptime new file mode 100755 index 000000000..e589d57d3 --- /dev/null +++ b/uptime @@ -0,0 +1,64 @@ +#!/bin/bash +# +# /etc/rc.d/init.d/uptime +# +# chkconfig: 345 70 30 +# description: Remote monitoring application using Node.js, MongoDB, and Twitter Bootstrap. + +# Source function library. +. /etc/init.d/functions + +RETVAL=0 +APP=uptime +LOCKFILE=/var/lock/subsys/${APP} + +NODE_APP=$(which node) +APP_ENTRYPOINT=app.js +APP_DIR=/var/www/${APP}/ +APP_LOG=/var/log/${APP}.log + +start() { + echo -n "Starting ${APP}: " + forever start -a -l ${APP_LOG} --minUptime 1000 --spinSleepTime 50 --sourceDir ${APP_DIR} --workingDir ${APP_DIR} ${APP_ENTRYPOINT} + RETVAL=$? + [ ${RETVAL} -eq 0 ] && rm -f ${LOCKFILE} + echo + return ${RETVAL} +} + +status() { + echo -n "Checking ${APP} status: " + forever list + RETVAL=$? + return ${RETVAL} +} + +stop() { + echo -n "Shutting down ${APP}: " + forever stopall + RETVAL=$? + [ ${RETVAL} -eq 0 ] && rm -f ${LOCKFILE} + echo + return ${RETVAL} +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status + ;; + restart) + stop + start + ;; + *) + echo "Usage: {start|stop|status|restart" + exit 1 + ;; +esac +exit $? From 8eaec33a8be8eb3fecd5f2af119b014a5aafa5c2 Mon Sep 17 00:00:00 2001 From: curtisz Date: Thu, 8 Jan 2015 14:25:07 -0800 Subject: [PATCH 2/2] added: uptime init script clarification regarding install directory location --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71814505e..2459dc320 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Lastly, start the application with: $ node app ``` -Alternatively, a simple init script is provided. To install this init script, copy `uptime` from the project's root directory to your system's init script directory (for example `/etc/init.d/`). Make sure the file is executable (`sudo chmod +x /etc/init.d/uptime`) and owned by root (`sudo chown root:root /etc/init.d/uptime`). To start the uptime service on every boot, register the service with your particular init system and enable it. +Alternatively, a simple init script is provided. It assumes Uptime is installed to `/var/www/uptime`. If Uptime is installed in a different directory, the `APP_DIR` variable needs to be changed to reflect the Uptime's true location. To install this init script, copy `uptime` from the project's root directory to your system's init script directory (for example `/etc/init.d/`). Make sure the file is executable (`sudo chmod +x /etc/init.d/uptime`) and owned by root (`sudo chown root:root /etc/init.d/uptime`). To start the uptime service on every boot, register the service with your particular init system and enable it. Upgrading From a 2.0 Install ----------------------------