#!/sbin/openrc-run # Copyright 2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 name="srtrelay server" description="SRT relay server for distributing media streams to multiple clients" command=/usr/bin/srtrelay command_args="-config ${SRTRELAY_CONFIG:-config.toml}" command_user=srtrelay:srtrelay supervisor="supervise-daemon" supervise_daemon_args="--stdout ${LOG_FILE:=/var/log/${RC_SVCNAME}.log} --stderr ${LOG_FILE}" depend() { use net after net } start_pre() { checkpath --mode 0640 \ --owner "${command_user}" \ --file "${LOG_FILE}" } start() { ebegin "Starting ${RC_SVCNAME}" ${supervisor} "${RC_SVCNAME}" \ -u ${command_user%:*} \ -g ${command_user#*:} \ ${supervise_daemon_args} \ -S "${command}" \ -- ${command_args} eend $? }