47 lines
1000 B
Bash
Executable File
47 lines
1000 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: mastodon_streaming
|
|
# REQUIRE: NETWORKING DAEMON postgres
|
|
# KEYWORD: shutdown
|
|
|
|
#
|
|
# Add the following lines to /etc/rc.conf to mastodon_streaming:
|
|
#
|
|
#mastodon_streaming_enable="YES"
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="mastodon_streaming"
|
|
rcvar="${name}_enable"
|
|
command="/usr/local/bin/node ./streaming"
|
|
start_cmd="${name}_start"
|
|
stop_cmd="${name}_stop"
|
|
|
|
pid_file="/var/run/${name}.pid"
|
|
|
|
mastodon_streaming_start(){
|
|
chdir /home/mastodon/live
|
|
/usr/sbin/daemon -S -l daemon -s debug -T "${name}" -p "${pid_file}" \
|
|
-u mastodon \
|
|
/usr/bin/env -i \
|
|
"NODE_ENV=production" "PORT=4000" "HOME=/home/mastodon" \
|
|
"STREAMING_CLUSTER_NUM=1" "USER=mastodon" "PATH=/usr/local/bin:${PATH}" $command
|
|
}
|
|
|
|
mastodon_streaming_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"
|