minidlna comes with a "rescan" command for rc.d. However, this reads rescan_cmd="$command -R -u $minidlna_uid -f /usr/local/etc/minidlna.conf" This is in line with the manpage, but obviously wrong when comparing to the commandline help (minidlnad -h): -r forces a rescan -R forces a rebuild So "-R" forces a rebuild of the database while a rescan uses "-r". I verified that this is what is actually happening by checking the database file and the time each command takes (rescan is fast and just adds new stuff, rebuild takes much longer and also removed outdated entries). Thus I propose to change the rc.d script to contain extra_commands="rescan rebuild" rescan_cmd="$command -r -u $minidlna_uid -f /usr/local/etc/minidlna.conf" rebuild_cmd="$command -R -u $minidlna_uid -f /usr/local/etc/minidlna.conf" Furthermore, as this is not handled via signals on the running process, it might be useful to force a stop command before doing either rescan or rebuild.
Created attachment 229687 [details] Proposed patch to rectify rescan/rebuild commands Add proposed patch (so far without forcing stop).
Comment on attachment 229687 [details] Proposed patch to rectify rescan/rebuild commands >--- minidlna.in~ 2021-11-24 08:46:30.000000000 +0100 >+++ minidlna.in 2021-11-24 08:47:17.757510000 +0100 >@@ -27,7 +27,8 @@ > start_precmd="install -d -o $minidlna_uid ${pidfile%/*} /var/db/minidlna" > stop_postcmd="rm -f $pidfile" > >-extra_commands=rescan >+extra_commands="rescan rebuild" >+rescan_cmd="$command -r -u $minidlna_uid -f %%PREFIX%%/etc/minidlna.conf" > rescan_cmd="$command -R -u $minidlna_uid -f %%PREFIX%%/etc/minidlna.conf" > > run_rc_command $1
Created attachment 229688 [details] patch with correct PREFIX path added Sorry for messing up the patch creation before, hopefully this will work now. ;-)
For the record: There is an open request for minidlna to support signal for rescan unter https://sourceforge.net/p/minidlna/patches/172/ However, it looks like this hasn't made it into any release, yet.