Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

added: init script, instructions in README, uptime-sns plugin link #290

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------------------

Expand Down Expand Up @@ -98,6 +100,7 @@ plugins:
- ./plugins/console
- ./plugins/patternMatcher
- ./plugins/httpOptions
- ./plugins/basicAuth
# - ./plugins/email
```

Expand Down Expand Up @@ -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
---------------
Expand Down
64 changes: 64 additions & 0 deletions uptime
Original file line number Diff line number Diff line change
@@ -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: <servicename> {start|stop|status|restart"
exit 1
;;
esac
exit $?