From b562309c6eb2fc02379043aba254821eaa706774 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Tue, 18 Aug 2026 16:03:40 +0200 Subject: [PATCH] Geloeschte NC-Verbindungen vor Laufzeitabruf entfernen --- runtime/run-all.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/runtime/run-all.sh b/runtime/run-all.sh index 990b0a3..8a4b265 100644 --- a/runtime/run-all.sh +++ b/runtime/run-all.sh @@ -3,6 +3,8 @@ set -Eeuo pipefail CONFIG_DIR="/etc/bratonien-tools/nc-connector" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +PIWIGO_ROOT="${PIWIGO_ROOT:-/var/www/piwigo}" +TOMBSTONE_DIR="${PIWIGO_ROOT%/}/_data/bratonien-tools/nc-connector-status" shopt -s nullglob configs=("$CONFIG_DIR"/connection-*.conf) @@ -13,7 +15,22 @@ fi result=0 for config in "${configs[@]}"; do - echo "NC Connector: $(basename "$config")" + name="$(basename "$config")" + connection_id="" + if [[ "$name" =~ ^connection-([0-9]+)\.conf$ ]]; then + connection_id="${BASH_REMATCH[1]}" + fi + + if [[ -n "$connection_id" && -f "$TOMBSTONE_DIR/deleted-$connection_id" ]]; then + echo "NC Connector: Verbindung $connection_id wurde geloescht; Laufzeitdateien werden entfernt." + rm -f -- "$CONFIG_DIR/connection-$connection_id.conf" \ + "$CONFIG_DIR/connection-$connection_id.db-password" \ + "$CONFIG_DIR/connection-$connection_id.piwigo-password" \ + "$CONFIG_DIR/connection-$connection_id.storages.tsv" + continue + fi + + echo "NC Connector: $name" if ! env PIWIGO_CONFIG="$config" bash "$SCRIPT_DIR/sync.sh"; then result=1 fi