#!/sbin/openrc-run
supervisor="supervise-daemon"
name="Iceshrimp.NET"
description="Iceshrimp.NET Fediverse server"
command="/usr/share/iceshrimp.net/Iceshrimp.Backend"
command_args="--migrate-and-start"
command_user="iceshrimp:iceshrimp"
no_new_privs=true
ICESHRIMP_CONFIG="${ICESHRIMP_CONFIG:-/etc/iceshrimp.net/configuration.ini}"
MALLOC_TRIM_THRESHOLD_="${MALLOC_TRIM_THRESHOLD:-131072}"
supervise_daemon_args="$supervise_daemon_args --env ICESHRIMP_CONFIG=${ICESHRIMP_CONFIG}"
supervise_daemon_args="$supervise_daemon_args --env MALLOC_TRIM_THRESHOLD_=${MALLOC_TRIM_THRESHOLD_}"
directory="/usr/share/iceshrimp.net"
pidfile="/run/${RC_SVCNAME}.pid"
stdout_logfile="${stdout_logfile:-/var/log/${RC_SVCNAME}/out.log}"
stderr_logfile="${stderr_logfile:-/var/log/${RC_SVCNAME}/err.log}"
output_logger="tsf $stdout_logfile"
error_logger="tsf $stderr_logfile"
depend() {
need net
after firewall
}
start_pre() {
# Copied from https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/installation/init.d/akkoma
# Ensure logfile ownership and perms are alright
checkpath --file --owner "$command_user" "$stdout_logfile" "$stderr_logfile" \
|| eerror "Logfile(s) not owned by $command_user, or not a file!"
checkpath --writable "$stdout_logfile" "$stderr_logfile" \
|| eerror "Logfile(s) not writable!"
}tsf is just a small wrapper script around ts from the moreutilspackage that adds timestamps since iceshrimp.net doesn't natively have those in their output:#!/bin/sh
ts >> "$1"You can set
output_logger and error_logger to logger -t $RC_SVCNAME if you want to log to syslog instead. Make sure to comment/remove the start_pre() function if you do that.