#!/sbin/openrc-run # Copyright 2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 name="MediaMTX media server and streaming proxy" description="Multi-protocol media server and media proxy for video and audio streams" command=/usr/bin/mediamtx command_args="${mediamtx_args}" command_user=mediamtx:mediamtx command_chdir="/var/lib/mediamtx" supervisor="supervise-daemon" depend() { use net after net } start_pre() { checkpath --owner "${command_user}" \ --mode 0750 \ --directory "${command_chdir}" checkpath --owner "${command_user}" \ --mode 0750 \ --directory "/var/log/mediamtx" } start() { ebegin "Starting ${RC_SVCNAME}" ${supervisor} "${RC_SVCNAME}" \ -u ${command_user%:*} \ -g ${command_user#*:} \ -d ${command_chdir} \ -S "${command}" \ -- ${command_args} eend $? }