second initial commit
This commit is contained in:
47
init.d/mastodon-streaming
Normal file
47
init.d/mastodon-streaming
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
. /etc/conf.d/mastodon
|
||||
|
||||
name="Mastodon streaming API service"
|
||||
|
||||
depend() {
|
||||
use net
|
||||
need mastodon
|
||||
}
|
||||
PORT="${SVCNAME#*.}"
|
||||
|
||||
|
||||
checkconfig() {
|
||||
if [ "$PORT" = "$SVCNAME" ]; then
|
||||
eerror "You cannot call this init script directly. Yo
|
||||
must create a symbolic link to it with the port number:"
|
||||
eerror " ln -s /etc/init.d/mastodon-streaming /etc
|
||||
eerror "And then call it instead:"
|
||||
eerror " /etc/init.d/mastodon-streaming.4000 start
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
start() {
|
||||
checkconfig || return 1
|
||||
ebegin "Starting Mastodon streaming API"
|
||||
|
||||
start-stop-daemon --start \
|
||||
--background --quiet \
|
||||
--chdir "${INSTALLROOT}" \
|
||||
--user="${USER}" \
|
||||
--make-pidfile --pidfile=${INSTALLROOT}/streaming.pid \
|
||||
--exec /usr/bin/env -- NODE_ENV=production PORT="$PORT" \
|
||||
/usr/bin/node ./streaming
|
||||
eend $? "Failed to start mastodon streaming service"
|
||||
}
|
||||
|
||||
stop() {
|
||||
checkconfig || return 1
|
||||
ebegin "Stopping Mastodon streaming API"
|
||||
start-stop-daemon --stop \
|
||||
--pidfile=${INSTALLROOT}/streaming.pid \
|
||||
eend $?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user