Skip to content

Instantly share code, notes, and snippets.

@alameenkhader
Created July 21, 2015 11:34
Show Gist options
  • Save alameenkhader/85217049b5077a6f18d7 to your computer and use it in GitHub Desktop.
Save alameenkhader/85217049b5077a6f18d7 to your computer and use it in GitHub Desktop.
rpush-monit.md

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-monit

check process pt-rpush with pidfile /srv/www/packagetracker/shared/pids/rpush.pid
    start program = "/etc/init.d/pt-rpush start"
    stop program = "/etc/init.d/pt-rpush stop"
#!/bin/sh
### BEGIN INIT INFO
# Provides:          pt-rpush
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Interactive:     false
# Short-Description: Package Tracker Rpush init script
# Description:       Package Tracker Rpush init script
### END INIT INFO

DESC="Service for Package Tracker Rpush"
NAME=pt-rpush
APP_ROOT=/srv/www/packagetracker/current

do_start()
{
   cd $APP_ROOT && /usr/local/bin/bundle exec rpush start -e production
   echo "starting!";
}

do_stop()
{
   cd $APP_ROOT && /usr/local/bin/bundle exec rpush stop -e production
   echo "stopping!"
}

case "$1" in
   start)
     do_start
     ;;
   stop)
     do_stop
     ;;
esac

sudo update-rc.d monit defaults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment