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