#!/sbin/runscript

# MQTT.Cool specific settings
# MC_HOME=/opt/mqtt.cool
MC_HOME=%MC_HOME%
# MC_USER=mqttcool
MC_USER=%MC_USER%
# MC_GROUP=mqttcool
MC_GROUP=%MC_GROUP%

DAEMON="${MC_HOME}/bin/unix-like/mc.sh"
PIDFILE=/var/run/mqttcool.pid

depend() {
	need net
}

start() {
	ebegin "Starting MQTT.Cool"
	start-stop-daemon --start --make-pidfile \
		--pidfile "${PIDFILE}" \
		--background --user ${MC_USER}:${MC_GROUP} \
		--exec "${DAEMON}" -- run
	eend "${?}"
}

stop() {
	ebegin "Stopping MQTT.Cool"
	start-stop-daemon --stop --pidfile "${PIDFILE}"
	eend "${?}"
}
