fix watch_status.json validation
All checks were successful
Docker Build Smart Logic / Build amd64 & arm64 (push) Successful in 17s
All checks were successful
Docker Build Smart Logic / Build amd64 & arm64 (push) Successful in 17s
This commit is contained in:
@@ -4,11 +4,14 @@ CONFIG_DIR="/config"
|
||||
CONFIG_FILE="$CONFIG_DIR/watchdog.conf"
|
||||
STATE_FILE="$CONFIG_DIR/watch_state.json"
|
||||
|
||||
# Sicherstellen, dass die Datei existiert und valides JSON ist
|
||||
if [ ! -f "$STATE_FILE" ] || [ ! -s "$STATE_FILE" ]; then echo "{}" > "$STATE_FILE"; fi
|
||||
# Initialisierung: Existiert die Datei UND ist sie valides JSON?
|
||||
# Falls nein (oder leer/korrupt), schreiben wir {} hinein.
|
||||
if [ ! -f "$STATE_FILE" ] || ! jq -e . "$STATE_FILE" >/dev/null 2>&1; then
|
||||
echo "⚠️ State-Datei war ungültig oder leer. Setze Reset auf {}."
|
||||
echo "{}" > "$STATE_FILE"
|
||||
fi
|
||||
|
||||
while true; do
|
||||
touch /config/test_file.txt && echo "Ich kann schreiben" > /config/test_file.txt
|
||||
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
source "$CONFIG_FILE"
|
||||
|
||||
Reference in New Issue
Block a user