diff --git a/README.md b/README.md index b1c9cfa48..2459dc320 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. 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 ---------------------------- @@ -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 $?