#!/bin/sh
### BEGIN INIT INFO
# Provides:          thin
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: thin initscript
# Description:       thin
### END INIT INFO

# Original author: Forrest Robertson

# Do NOT "set -e"

DAEMON=/usr/bin/thin
SCRIPT_NAME=/etc/init.d/thin

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

run_action() {
        ACTION="$1"
	
	if [ -x /usr/bin/ruby2.7 ]; then
	    /usr/bin/ruby2.7 $DAEMON $ACTION --all /etc/thin2.7
	fi
	
}

case "$1" in
  start)
	run_action start
	;;
  stop)
	run_action stop
	;;
  restart|force-reload|reload)
	run_action restart
	;;
  *)
	echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
	exit 3
	;;
esac

:
