From 272dde72bcc63579e90bc3c99293afe3b70ee9e7 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 16 Jun 2026 20:13:45 +0200 Subject: [PATCH] fix: auto-restart via PM2 fallback when systemd not found --- update-Nitrov3.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/update-Nitrov3.sh b/update-Nitrov3.sh index 7181741..c42c0e1 100755 --- a/update-Nitrov3.sh +++ b/update-Nitrov3.sh @@ -320,17 +320,21 @@ fi # ---------------------------------------- # 7. Restart the Service (only if updates were applied) # ---------------------------------------- -if [ "$HAD_UPDATES" = true ] && systemctl cat "$EMULATOR_SERVICE" &>/dev/null; then - echo "--> Restarting $EMULATOR_SERVICE service..." - if command -v sudo &> /dev/null; then - sudo systemctl restart "$EMULATOR_SERVICE" - sudo systemctl status "$EMULATOR_SERVICE" --no-pager -n 5 +if [ "$HAD_UPDATES" = true ]; then + if systemctl cat "$EMULATOR_SERVICE" &>/dev/null; then + echo "--> Restarting $EMULATOR_SERVICE service..." + if command -v sudo &> /dev/null; then + sudo systemctl restart "$EMULATOR_SERVICE" + sudo systemctl status "$EMULATOR_SERVICE" --no-pager -n 5 + else + echo "--> Sudo not available. Restart the service manually: sudo systemctl restart $EMULATOR_SERVICE" + fi + elif command -v pm2 &> /dev/null; then + echo "--> Restarting PM2 processes..." + pm2 restart all else - echo "--> Sudo not available. Restart the service manually: sudo systemctl restart $EMULATOR_SERVICE" + echo "--> Warning: Neither systemd nor PM2 found. Restart the emulator manually." fi -else - echo "--> Warning: Service '$EMULATOR_SERVICE' not found in systemd." - echo "--> If you use PM2, restart your processes manually: pm2 restart all" fi