From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Fri, 20 May 2022 11:30:08 +0000 (+0100) Subject: Stop using libdaemon and use FreeBSD's daemon utility to deamonise and control shairp... X-Git-Tag: 4.1-rc1~24^2~206 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b246c88fd961a89cb6abcfc47f5eac6eb7f3c474;p=thirdparty%2Fshairport-sync.git Stop using libdaemon and use FreeBSD's daemon utility to deamonise and control shairport sync. --- diff --git a/scripts/shairport-sync.freebsd b/scripts/shairport-sync.freebsd index 4e812dd0..0b74f950 100644 --- a/scripts/shairport-sync.freebsd +++ b/scripts/shairport-sync.freebsd @@ -9,20 +9,16 @@ name="shairport_sync" rcvar="shairport_sync_enable" -start_cmd="${name}_start" -stop_cmd="${name}_stop" +# NOTE the difference between the service name shairport_sync and the application and script file names shairport-sync. +# This seems to be necessary in FreeBSD, as the startup system doesn't seem to like dashes ("-") in service names. -shairport_sync_start() -{ - checkyesno shairport_sync_enable && echo "Starting shairport-sync." && \ - su -m shairport-sync -c "/usr/local/bin/shairport-sync -d" -} +pidfile="/var/run/shairport-sync.pid" +apptodaemonise="/usr/local/bin/shairport-sync" -shairport_sync_stop() -{ - checkyesno shairport_sync_enable && echo "Stopping shairport-sync." && \ - /usr/local/bin/shairport-sync -k -} +command="/usr/sbin/daemon" +# -S log to syslog; -P store the supervisor PID; -u to specify the user to run the service under +command_args="-u shairport-sync -S -T shairport-sync -P ${pidfile} ${apptodaemonise}" load_rc_config $name run_rc_command "$1" +