Skip to content

Instantly share code, notes, and snippets.

@lastcanal
Created January 5, 2016 17:33
Show Gist options
  • Select an option

  • Save lastcanal/fe08f27ecaadcb1d6a87 to your computer and use it in GitHub Desktop.

Select an option

Save lastcanal/fe08f27ecaadcb1d6a87 to your computer and use it in GitHub Desktop.
libbitcoin-server monit config
#!/bin/sh
### BEGIN INIT INFO
# Provides: bs
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: bs
# Description: bs
### END INIT INFO
# Change the next 3 lines to suit where you install your script and what you want to call it
DAEMON=/usr/local/bin/bs
DAEMON_ARGS=
DAEMON_NAME=bs
DAEMON_USER=bs
PIDFILE=/var/run/$DAEMON_NAME.pid
#set -x
. /lib/lsb/init-functions
do_start () {
log_daemon_msg "Starting system $DAEMON_NAME daemon"
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile -c $DAEMON_USER --startas $DAEMON -- $DAEMON_ARGS
log_end_msg $?
}
do_stop () {
log_daemon_msg "Stopping system $DAEMON_NAME daemon"
start-stop-daemon --stop --pidfile $PIDFILE --retry 10
log_end_msg $?
}
case "$1" in
start|stop)
do_${1}
;;
restart|reload|force-reload)
do_stop
do_start
;;
status)
status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$DEAMON_NAME {start|stop|restart|status}"
exit 1
;;
esac
exit 0
check process bs with pidfile /var/run/bs.pid
start program "/etc/init.d/bs start"
stop program "/etc/init.d/bs stop"
if failed port 9091 type tcp
with timeout 15 seconds
then restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment