I've been using Alpine Linux for my hdhomerun_record DVR for the last year, and it just occurred to me that I have an OpenRC script for controlling hdhomerun_record as a service that perhaps I should share with everyone, since I don't think I've seen another one of these around.
It was my first experience writing an OpenRC script so my apologies if it's a little choppy, I find it works fine though. Was pretty similar to the rc script from FreeBSD, just slightly different syntax. If someone with more experience would like to chime in, I'd appreciate it.
/etc/init.d/hdhomerun_record
Code: Select all
#!/sbin/openrc-run
#
name=$SVCNAME
cfgfile="/etc/$SVCNAME.conf"
pidfile="/var/run/$SVCNAME/$SVCNAME.pid"
command=/usr/sbin/$SVCNAME
command_user="daemon"
command_args="start foreground --conf=/etc/hdhomerun_record.conf"
start() $command $command_args
restart() $command "restart"
stop() $command "stop"
status() $command "status"
File locations are somewhat arbitrary, but appeared to follow the pattern I see for a common *nix directory structure. You can really put them wherever you want.
Here's a few good references for OpenRC (the first two were my primary source of this script's structure):
https://github.com/OpenRC/openrc/blob/m ... t-guide.md
https://wiki.gentoo.org/wiki/OpenRC
https://wiki.archlinux.org/index.php/OpenRC
https://wiki.gentoo.org/wiki/OpenRC_to_ ... Cheatsheet