second initial commit

This commit is contained in:
2026-04-12 15:46:17 -05:00
parent 7949e8b3b6
commit cb485ee2de
5 changed files with 150 additions and 0 deletions

47
init.d/mastodon-streaming Normal file
View 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 $?
}