@@ -270,12 +270,18 @@ if [[ ! -f "$INSTALL_PATH/nebula-sync" ]]; then
270270fi
271271
272272msg_info "Stopping service"
273- systemctl stop nebula-sync.service &>/dev/null || true
273+ if systemctl is-active --quiet nebula-sync.service 2>/dev/null; then
274+ systemctl stop nebula-sync.service
275+ fi
274276msg_ok "Stopped service"
275277
276278msg_info "Backing up configuration"
277- cp "$ENV_PATH " /tmp/nebula-sync.env.bak 2>/dev/null || true
278- msg_ok "Backed up configuration"
279+ if [[ -f "$ENV_PATH " ]]; then
280+ cp "$ENV_PATH " /tmp/nebula-sync.env.bak
281+ msg_ok "Backed up configuration"
282+ else
283+ msg_warn "Configuration file not found, skipping backup"
284+ fi
279285
280286msg_info "Detecting latest Nebula-Sync release"
281287LATEST_RELEASE=$( curl -fsSL https://api.github.com/repos/lovelaze/nebula-sync/releases/latest | sed -n ' s/.*"tag_name": *"\([^"]*\)".*/\1/p' )
@@ -302,9 +308,13 @@ chmod +x nebula-sync
302308msg_ok "Downloaded Nebula-Sync"
303309
304310msg_info "Restoring configuration"
305- cp /tmp/nebula-sync.env.bak "$ENV_PATH " 2>/dev/null || true
306- rm -f /tmp/nebula-sync.env.bak
307- msg_ok "Restored configuration"
311+ if [[ -f /tmp/nebula-sync.env.bak ]]; then
312+ cp /tmp/nebula-sync.env.bak "$ENV_PATH "
313+ rm -f /tmp/nebula-sync.env.bak
314+ msg_ok "Restored configuration"
315+ else
316+ msg_warn "Backup file not found, keeping existing configuration"
317+ fi
308318
309319msg_info "Saving version"
310320echo "${LATEST_RELEASE} " > "/opt/nebula-sync_version.txt"
0 commit comments