Skip to content

Instantly share code, notes, and snippets.

@pooza
Created May 29, 2017 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pooza/c249f3bc56744b15758bcfd805093381 to your computer and use it in GitHub Desktop.
Save pooza/c249f3bc56744b15758bcfd805093381 to your computer and use it in GitHub Desktop.
#!/bin/sh
# PROVIDE: mastodon
# REQUIRE: LOGIN
# BEFORE: securelevel
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf to enable `mastodon':
#
#mastodon_enable="YES"
export PATH="/usr/local/bin:/bin:/usr/bin"
. /etc/rc.subr
name="mastodon"
rcvar="${name}_enable"
load_rc_config "$name"
: ${mastodon_enable="NO"}
: ${mastodon_path="/usr/local/www/mastodon"}
: ${mastodon_env="production"}
start_cmd=${name}_start
stop_cmd=${name}_stop
mastodon_start() {
export RAILS_ENV=$mastodon_env
cd $mastodon_path
bundle exec rails server puma
}
mastodon_stop() {
kill `cat $mastodon_path/tmp/pids/puma.pid`
}
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment