#!/sbin/openrc-run

name="Mastodon"
description="Meta script for starting/stopping all the Mastodon components"

subservices="mastodon.sidekiq mastodon.streaming mastodon.web"

depend() {
	need redis postgresql
	use net
}

start() {
	local ret=0

	ebegin "Starting all Mastodon components"
	local svc; for svc in $subservices; do
		service $svc start || ret=1
	done
	eend $ret
}

stop() {
	local ret=0

	ebegin "Stopping all Mastodon components"
	local svc; for svc in $subservices; do
		service $svc stop || ret=1
	done
	eend $ret
}

status() {
	local ret=0

	local svc; for svc in $subservices; do
		echo "$svc:"
		service $svc status || ret=1
	done
	eend $ret
}
