mirror of
https://github.com/unraid/api.git
synced 2026-01-03 23:19:54 -06:00
fix(plugin): add fallback for unraid-api stop in deprecation cleanup (#1668)
This commit is contained in:
@@ -112,12 +112,13 @@ perform_connect_cleanup() {
|
||||
if [ -f "/boot/config/plugins/dynamix.my.servers/configs/connect.json" ] || [ -f "/boot/config/plugins/dynamix.my.servers/myservers.cfg" ]; then
|
||||
# Stop unraid-api
|
||||
printf "\nStopping unraid-api. Please wait...\n"
|
||||
output=$(/etc/rc.d/rc.unraid-api stop --delete 2>&1)
|
||||
if [ -z "$output" ]; then
|
||||
echo "Waiting for unraid-api to stop..."
|
||||
sleep 5 # Give it time to stop
|
||||
if [ -f "/etc/rc.d/rc.unraid-api" ]; then
|
||||
/etc/rc.d/rc.unraid-api stop 2>&1
|
||||
elif command -v unraid-api >/dev/null 2>&1; then
|
||||
unraid-api stop 2>&1
|
||||
else
|
||||
echo "⚠️ Warning: Neither /etc/rc.d/rc.unraid-api nor unraid-api command found"
|
||||
fi
|
||||
echo "Stopped unraid-api: $output"
|
||||
|
||||
# Sign out of Unraid Connect (we'll use curl directly from shell)
|
||||
# We need to extract the username from connect.json or myservers.cfg and the registration key
|
||||
@@ -130,7 +131,7 @@ perform_connect_cleanup() {
|
||||
has_username=true
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Fallback to myservers.cfg (legacy format)
|
||||
if [ "$has_username" = false ] && [ -f "/boot/config/plugins/dynamix.my.servers/myservers.cfg" ]; then
|
||||
if grep -q 'username' "/boot/config/plugins/dynamix.my.servers/myservers.cfg"; then
|
||||
|
||||
@@ -29,12 +29,13 @@ perform_connect_cleanup() {
|
||||
if [ -f "/boot/config/plugins/dynamix.my.servers/configs/connect.json" ] || [ -f "/boot/config/plugins/dynamix.my.servers/myservers.cfg" ]; then
|
||||
# Stop unraid-api
|
||||
printf "\nStopping unraid-api. Please wait...\n"
|
||||
output=$(/etc/rc.d/rc.unraid-api stop --delete 2>&1)
|
||||
if [ -z "$output" ]; then
|
||||
echo "Waiting for unraid-api to stop..."
|
||||
sleep 5 # Give it time to stop
|
||||
if [ -f "/etc/rc.d/rc.unraid-api" ]; then
|
||||
/etc/rc.d/rc.unraid-api stop 2>&1
|
||||
elif command -v unraid-api >/dev/null 2>&1; then
|
||||
unraid-api stop 2>&1
|
||||
else
|
||||
echo "⚠️ Warning: Neither /etc/rc.d/rc.unraid-api nor unraid-api command found"
|
||||
fi
|
||||
echo "Stopped unraid-api: $output"
|
||||
|
||||
# Sign out of Unraid Connect (we'll use curl directly from shell)
|
||||
# We need to extract the username from connect.json or myservers.cfg and the registration key
|
||||
|
||||
Reference in New Issue
Block a user