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

START=99

USE_PROCD=1
PROG=/usr/share/ucentral/health.uc

boot() {
	# dummy stub to make sure health does not start before
	# a config is applied
	true
}

service_triggers() {
	procd_add_reload_trigger ustats
}

start_service() {
	. /lib/functions.sh
	config_load 'ustats'
	config_get interval 'health' 'interval' 120

	[ "$interval" -eq 0 ] || {
		procd_open_instance
		procd_set_param command "$PROG"
		procd_set_param respawn 1 $interval 0
		procd_close_instance
	}
}
