#!/sbin/openrc-run

depend() {
	after mosquitto
}

start() {
	ebegin "Starting ${SVCNAME}"
	start-stop-daemon --start --user node-red:node-red --chdir /usr/lib64/node_modules/node-red/packages/node_modules/node-red/ --exec /usr/bin/npm --background --make-pidfile --pidfile /run/${SVCNAME}.pid -- start
	eend $?
}

stop() {
	ebegin "Stopping ${SVCNAME}"
	start-stop-daemon --stop --quiet --retry 10 --pidfile /run/${SVCNAME}.pid
	eend $?
}
