From ce3aad39474789faa7e3c8fd49a6f401c8fa3c01 Mon Sep 17 00:00:00 2001
From: xengineering <me@xengineering.eu>
Date: Sat, 20 Jan 2024 15:20:02 +0100
Subject: doc: Add OpenRC service configuration

This makes sure the audio-receiving software `ffplay` runs all the time.
---
 doc/documentation.tex | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'doc/documentation.tex')

diff --git a/doc/documentation.tex b/doc/documentation.tex
index fb004f7..1162727 100644
--- a/doc/documentation.tex
+++ b/doc/documentation.tex
@@ -226,7 +226,8 @@ apk add
 To make the soundbox device discoverable inside the network the Link Layer
 Discovery Protocol (LLDP) is used. With \texttt{echo} a new configuration file
 for the \texttt{lldpd} software can be added. After configuration the
-\texttt{lldpd} service is enabled to start by default with the next reboot.
+\texttt{lldpd} service is enabled via \texttt{rc-update} to start by default
+with the next reboot.
 
 \begin{verbatim}
 echo 'configure system hostname soundbox.local
@@ -264,6 +265,25 @@ option has to be inserted instead:
 echo 'dtparam=audio=on' >> /media/mmcblk0p1/config.txt
 \end{verbatim}
 
+\subsection{Service configuration}
+
+To receive audio streams via the network it is required to run the
+\texttt{ffplay} command continuously. This is possible by creating a service
+file for the OpenRC init system with \texttt{echo} and enabling the service
+with \texttt{rc-update}.
+
+\begin{verbatim}
+echo '#!/sbin/openrc-run
+
+name="soundbox"
+command="/usr/bin/ffplay"
+command_args="udp://224.0.0.99:5316"
+pidfile="/run/soundbox.pid"
+command_background=true' > /etc/init.d/soundbox
+
+rc-update add soundbox default
+\end{verbatim}
+
 \subsection{Persistence of changes and reboot}
 
 Since a diskless Alpine Linux installation is preferred for soundbox the
-- 
cgit v1.2.3-70-g09d2

