#!/bin/sh /etc/rc.common
# SecuBox Threat Analyst Daemon

START=99
STOP=10
USE_PROCD=1

PROG=/usr/bin/threat-analyst
CONFIG=threat-analyst

start_service() {
	local enabled
	config_load "$CONFIG"
	config_get enabled main enabled 0

	[ "$enabled" != "1" ] && return 0

	procd_open_instance
	procd_set_param command "$PROG" daemon
	procd_set_param respawn 3600 5 5
	procd_set_param stdout 1
	procd_set_param stderr 1
	procd_set_param pidfile /var/run/threat-analyst.pid
	procd_close_instance
}

service_triggers() {
	procd_add_reload_trigger "$CONFIG"
}

reload_service() {
	stop
	start
}
