Skip to content

Commit e314dd2

Browse files
committed
update.sh: disable service during binary swap to prevent restart race
1 parent cf057cc commit e314dd2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

update.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ fi
6161
log "Stopping service"
6262
# Delay so client could read the "Stopping service" message before the service is stopped and the connection is lost
6363
sleep 2
64-
systemctl stop "$APP_NAME"
64+
systemctl disable --now "$APP_NAME"
6565
cp "$BIN_FILE" "$INSTALL_DIR/App"
6666
chown $APP_USER:$APP_USER "$BIN_FILE" "$INSTALL_DIR/App"
67-
setcap 'cap_net_bind_service=+ep' "$INSTALL_DIR/App" # Allow binding to port 443 without root
67+
setcap 'cap_net_bind_service=+ep' "$INSTALL_DIR/App"
6868
ok "Binary updated"
6969

7070
# Restart the service to pick up the new binary
7171
log "Restarting service"
72-
systemctl restart "$APP_NAME"
72+
systemctl enable --now "$APP_NAME"
7373
ok "Service '$APP_NAME' restarted"

0 commit comments

Comments
 (0)