From 99ce88bfdc0a7f020c42f2fe0c6a0f4e32ac8f5a Mon Sep 17 00:00:00 2001 From: Pujit Mehrotra Date: Mon, 15 Dec 2025 16:27:51 -0500 Subject: [PATCH] fix(plg): explicitly stop an existing api before installation (#1841) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Necessary for "clean" upgrades to api orchestration (eg changing how the api is daemonized). Prior to this, `rc.unraid-api start` would also restart a running api, which sufficed for application updates, but is insufficient for orchestration updates. ## Summary by CodeRabbit * **Bug Fixes** * Improved update reliability by ensuring services are properly stopped before system modifications occur. ✏️ Tip: You can customize this high-level summary in your review settings. --- plugin/plugins/dynamix.unraid.net.plg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/plugins/dynamix.unraid.net.plg b/plugin/plugins/dynamix.unraid.net.plg index 4d61f4677..6e8a60e69 100755 --- a/plugin/plugins/dynamix.unraid.net.plg +++ b/plugin/plugins/dynamix.unraid.net.plg @@ -480,6 +480,12 @@ if [ "$SKIP_API_INSTALL" = false ]; then fi done + # Stop the API service before mutating /usr/local/unraid-api to avoid upgrade races + if [ -x "/etc/rc.d/rc.unraid-api" ]; then + echo "Stopping Unraid API service before upgrade..." + /etc/rc.d/rc.unraid-api stop || echo "Warning: Failed to stop Unraid API service" + fi + # Remove existing node_modules directory echo "Cleaning up existing node_modules directory..." if [ -d "/usr/local/unraid-api/node_modules" ]; then