I have my acme client set to restart the opnsense web ui and adguardhome when a certificate renews. My dns went out randomly this weekend and I determined that adguard stopped running after my cert was renewed.
I discovered that the adguardhome restart command wasn't waiting until the process exited before restarting the process, causing any restart to fail like this:
I solved this by updating the rc script to wait for the process to exit and everything is working smoothly now. Here is the patch for the updated script (since adguard is not in this repo): adguardhome.patch
--- adguardhome.old 2024-03-17 15:39:35
+++ adguardhome.new 2024-03-17 15:31:41
@@ -12,7 +12,7 @@
command=/usr/sbin/daemon
command_args="-f -P /var/run/adguardhome.pid /usr/local/AdGuardHome/AdGuardHome -s run &"
-stop_cmd="killall AdGuardHome"
+stop_cmd=adguardhome_stop
status_cmd=adguardhome_status
load_rc_config adguardhome
@@ -30,5 +30,18 @@
fi
}
+adguardhome_stop()
+{
+ # wait for process to exit
+ if [ -n "$rc_pid" ]; then
+ echo "Stopping ${name}."
+ kill $rc_pid
+ echo "Waiting for PIDS: $rc_pid"
+ wait_for_pids $rc_pid
+ echo " done."
+ else
+ echo "${name} is not running."
+ fi
+}
run_rc_command $1
I have my acme client set to restart the opnsense web ui and adguardhome when a certificate renews. My dns went out randomly this weekend and I determined that adguard stopped running after my cert was renewed.
I discovered that the adguardhome restart command wasn't waiting until the process exited before restarting the process, causing any restart to fail like this:
This issue was mentioned in this comment in #171
I solved this by updating the rc script to wait for the process to exit and everything is working smoothly now. Here is the patch for the updated script (since adguard is not in this repo): adguardhome.patch
edit: inlined the patch