48 lines
1001 B
Bash
Executable File
48 lines
1001 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: mastodon_web
|
|
# REQUIRE: NETWORKING DAEMON postgres
|
|
# KEYWORD: shutdown
|
|
|
|
#
|
|
# Add the following lines to /etc/rc.conf to mastodon_web:
|
|
#
|
|
#mastodon_web_enable="YES"
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="mastodon_web"
|
|
rcvar="${name}_enable"
|
|
command="/usr/local/bin/bundle exec puma -C config/puma.rb"
|
|
command_interpreter="/usr/local/bin/bundle"
|
|
start_cmd="${name}_start"
|
|
stop_cmd="${name}_stop"
|
|
|
|
pid_file="/var/run/${name}.pid"
|
|
|
|
mastodon_web_start(){
|
|
chdir /home/mastodon/live
|
|
/usr/sbin/daemon -S -l daemon -s debug -T "${name}" -p "${pid_file}" \
|
|
-u mastodon \
|
|
/usr/bin/env -i \
|
|
"RAILS_ENV=production" "PORT=3000" "HOME=/home/mastodon" \
|
|
"USER=mastodon" "PATH=/usr/local/bin:${PATH}" $command
|
|
}
|
|
|
|
mastodon_web_stop(){
|
|
if [ -f "$pid_file" ]; then
|
|
echo -n "Stopping services: ${name}"
|
|
kill -s INT $(cat "$pid_file")
|
|
echo "."
|
|
else
|
|
echo "It appears ${name} is not running."
|
|
fi
|
|
}
|
|
|
|
|
|
load_rc_config ${name}
|
|
run_rc_command "$1"
|