#!/bin/sh /etc/rc.common

START=99
USE_PROCD=1

CONF="lingtigameacc"
PROG="/usr/bin/lingti"

start_service() {
	config_load "$CONF"
	local enabled
	config_get_bool enabled "config" "enabled" "0"
	[ "$enabled" -eq "1" ] || return 1


  procd_open_instance "$CONF"
  procd_set_param command "$PROG"

  # respawn automatically if something died, be careful if you have an alternative process supervisor
  # if process dies sooner than respawn_threshold, it is considered crashed and after 5 retries the service is stopped
  procd_set_param respawn ${respawn_threshold:-600} ${respawn_timeout:-3} ${respawn_retry:-5}

  procd_set_param stdout 1 # forward stdout of the command to logd
  procd_set_param stderr 1 # same for stderr
  procd_set_param user root
  procd_close_instance
}

reload_service() {
	stop
	start
}

service_triggers() {
	procd_add_reload_trigger "$CONF"
}
