/mastodon/rc.d/mastodon-streaming
#!/bin/sh

# PROVIDE: mastodon_streaming
# REQUIRE: DAEMON mastodon_web
# KEYWORD: shutdown

. /etc/rc.subr

name="mastodon_streaming"
rcvar="mastodon_enable"

pidfile="/var/run/mastodon-streaming.pid"
mastodon_streaming_chdir="/home/mastodon/live"
mastodon_streaming_env="NODE_ENV=production PORT=4000 STREAMING_CLUSTER_NUM=1"
command="/usr/sbin/daemon"
command_args="-u mastodon -P ${pidfile} -H -o /var/log/mastodon/streaming.log /usr/local/bin/node ./streaming"

# read configuration and set defaults
load_rc_config "$name"
: ${mastodon_enable="NO"}

run_rc_command "$1"