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

START=99
STOP=11
USE_PROCD=1

ARGS="start"

start_service() {
	if [ ! -f /etc/qbee/qbee-agent.json ]; then
		echo "Device seems to not have been bootstrapped. Please run 'qbee-agent bootstrap -k <bootstrap-key>' as root to bootstrap."
		return 0
	fi

	procd_open_instance qbee-agent
	procd_set_param command /usr/bin/qbee-agent $ARGS
	procd_set_param respawn 3600 60 0
	procd_set_param stdout 1
	procd_set_param stderr 1
	procd_set_param pidfile /var/run/qbee-agent.pid
	procd_set_param term_timeout 600
	procd_close_instance
}
