From d775916217e74e706a2eee4d2e545c705e418eb0 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Wed, 20 Aug 2025 15:57:19 +0000 Subject: [PATCH] improve: handle both pulse and pulse-backend service names gracefully - ProxmoxVE community script uses pulse-backend.service - Our install script now detects and preserves existing service name - Removed pulse-backend.service from pre-v4 detection (it's used by v4 too) - Install script stops the correct service during upgrades - New installs use 'pulse', existing use whatever they have This ensures compatibility with all deployment methods without breaking changes. --- install.sh | 28 +++++++++++++++++++++++++--- internal/updates/manager.go | 7 ++----- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index 529cd66a7..36033ad8e 100755 --- a/install.sh +++ b/install.sh @@ -19,6 +19,17 @@ SERVICE_NAME="pulse" GITHUB_REPO="rcourtman/Pulse" REQUIRED_GO_VERSION="1.21" +# Detect existing service name (pulse or pulse-backend) +detect_service_name() { + if systemctl list-unit-files --no-legend | grep -q "^pulse-backend.service"; then + echo "pulse-backend" + elif systemctl list-unit-files --no-legend | grep -q "^pulse.service"; then + echo "pulse" + else + echo "pulse" # Default for new installations + fi +} + # Functions print_header() { echo -e "${BLUE}=================================================${NC}" @@ -219,10 +230,13 @@ download_pulse() { exit 1 fi + # Detect existing service name + EXISTING_SERVICE=$(detect_service_name) + # Stop service if running (for updates) - if systemctl is-active --quiet $SERVICE_NAME; then - print_info "Stopping existing Pulse service..." - systemctl stop $SERVICE_NAME + if systemctl is-active --quiet $EXISTING_SERVICE; then + print_info "Stopping existing Pulse service ($EXISTING_SERVICE)..." + systemctl stop $EXISTING_SERVICE fi # Extract to temporary directory first @@ -277,6 +291,14 @@ setup_directories() { install_systemd_service() { print_info "Installing systemd service..." + # Use existing service name if found, otherwise use default + EXISTING_SERVICE=$(detect_service_name) + if [[ "$EXISTING_SERVICE" == "pulse-backend" ]] && [[ -f "/etc/systemd/system/pulse-backend.service" ]]; then + # Keep using pulse-backend for compatibility (ProxmoxVE) + SERVICE_NAME="pulse-backend" + print_info "Using existing service name: pulse-backend" + fi + cat > /etc/systemd/system/$SERVICE_NAME.service << EOF [Unit] Description=Pulse Monitoring Server diff --git a/internal/updates/manager.go b/internal/updates/manager.go index 1e635aa81..9e9c90aa9 100644 --- a/internal/updates/manager.go +++ b/internal/updates/manager.go @@ -689,11 +689,8 @@ func isPreV4Installation() bool { return true } - // Check for old service names - cmd := exec.Command("systemctl", "list-unit-files", "--no-legend", "pulse-backend.service") - if output, err := cmd.Output(); err == nil && len(output) > 0 { - return true - } + // Note: pulse-backend.service is used by both v4 and pre-v4, so we can't use it as an indicator + // Only check for Node.js artifacts which are exclusive to pre-v4 // Check for Node.js artifacts nodeArtifacts := []string{