From 69a5b09af9e9863efbb9e95db62ba7c1db4227f1 Mon Sep 17 00:00:00 2001 From: Pujit Mehrotra Date: Mon, 15 Dec 2025 13:03:13 -0500 Subject: [PATCH] fix(plg): explicitly stop an existing api before installation 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. --- 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 eeed6411c8..761745e7bb 100755 --- a/plugin/plugins/dynamix.unraid.net.plg +++ b/plugin/plugins/dynamix.unraid.net.plg @@ -478,6 +478,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