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

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

. /etc/rc.subr

name="mastodon_web"
rcvar="mastodon_enable"

pidfile="/var/run/mastodon-web.pid"
mastodon_web_chdir="/home/mastodon/live"
mastodon_web_env="RAILS_ENV=production"
command="/usr/sbin/daemon"
command_args="-u mastodon -P ${pidfile} -H -o /var/log/mastodon/web.log /usr/local/bin/bundle exec puma -C config/puma.rb"

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

run_rc_command "$1"