From a4bd585730d42befaf2c089f7f879ef96226610c Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 1 Sep 2025 08:48:55 +0200 Subject: [PATCH] =?UTF-8?q?F=C3=BCge=20=C3=9Cberpr=C3=BCfung=20und=20Stopp?= =?UTF-8?q?=20des=20Services=20vor=20dem=20Kopieren=20der=20Dateien=20im?= =?UTF-8?q?=20Skript=20deploy-server.sh=20hinzu.=20Aktualisiere=20die=20Nu?= =?UTF-8?q?mmerierung=20der=20Schritte=20f=C3=BCr=20eine=20bessere=20?= =?UTF-8?q?=C3=9Cbersichtlichkeit=20und=20entferne=20die=20=C3=9Cberpr?= =?UTF-8?q?=C3=BCfung,=20ob=20der=20Service=20bereits=20l=C3=A4uft,=20bevo?= =?UTF-8?q?r=20er=20neu=20gestartet=20wird.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy-server.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/deploy-server.sh b/deploy-server.sh index 7e1387d..532ebe4 100755 --- a/deploy-server.sh +++ b/deploy-server.sh @@ -109,37 +109,40 @@ mkdir -p "$REMOTE_DIR"/{logs,config} sudo mkdir -p /etc/yourpart sudo mkdir -p /var/log/yourpart -# 5. Kopiere Dateien +# 5. Stoppe Service falls läuft +log_info "Stoppe Service falls läuft..." +if sudo systemctl is-active --quiet "$SERVICE_NAME"; then + log_info "Stoppe laufenden Service..." + sudo systemctl stop "$SERVICE_NAME" + sleep 2 +fi + +# 6. Kopiere Dateien log_info "Kopiere Dateien..." sudo cp "$BUILD_DIR/yourpart-daemon" /usr/local/bin/ sudo cp daemon.conf /etc/yourpart/ sudo cp yourpart-daemon.service /etc/systemd/system/ -# 6. Setze Berechtigungen +# 7. Setze Berechtigungen log_info "Setze Berechtigungen..." sudo chmod +x /usr/local/bin/yourpart-daemon sudo chown -R "$DAEMON_USER:$DAEMON_USER" "$REMOTE_DIR" sudo chown -R "$DAEMON_USER:$DAEMON_USER" /var/log/yourpart sudo chmod 600 /etc/yourpart/daemon.conf -# 7. Lade systemd neu +# 8. Lade systemd neu log_info "Lade systemd Konfiguration neu..." sudo systemctl daemon-reload -# 8. Aktiviere Service +# 9. Aktiviere Service log_info "Aktiviere Service..." sudo systemctl enable "$SERVICE_NAME" -# 9. Starte Service +# 10. Starte Service log_info "Starte Service..." -if sudo systemctl is-active --quiet "$SERVICE_NAME"; then - log_info "Service läuft bereits, starte neu..." - sudo systemctl restart "$SERVICE_NAME" -else - sudo systemctl start "$SERVICE_NAME" -fi +sudo systemctl start "$SERVICE_NAME" -# 10. Prüfe Status +# 11. Prüfe Status log_info "Prüfe Service-Status..." sleep 2 if sudo systemctl is-active --quiet "$SERVICE_NAME"; then