Add Unraid automation script templates
This commit is contained in:
@@ -7,7 +7,7 @@ Diese Vorlagen binden die validierten Restore-Checks in Unraid User Scripts ein.
|
|||||||
Host-Repo-Pfad:
|
Host-Repo-Pfad:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
/mnt/user/services/homelab
|
/mnt/user/services/homelab-infra
|
||||||
```
|
```
|
||||||
|
|
||||||
## Script 1 - `restore-freshness-weekly`
|
## Script 1 - `restore-freshness-weekly`
|
||||||
@@ -20,7 +20,7 @@ Inhalt:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
bash /mnt/user/services/homelab/ops/restore-tests/run-restore-checks.sh freshness \
|
bash /mnt/user/services/homelab-infra/ops/restore-tests/run-restore-checks.sh freshness \
|
||||||
> /mnt/user/backups/restore-reports/freshness-$(date +%F).md
|
> /mnt/user/backups/restore-reports/freshness-$(date +%F).md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ V1-Inhalt:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
bash /mnt/user/services/homelab/ops/restore-tests/run-restore-checks.sh vaultwarden \
|
bash /mnt/user/services/homelab-infra/ops/restore-tests/run-restore-checks.sh vaultwarden \
|
||||||
> /mnt/user/backups/restore-reports/vaultwarden-$(date +%F).md
|
> /mnt/user/backups/restore-reports/vaultwarden-$(date +%F).md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ V1-Inhalt:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
bash /mnt/user/services/homelab/ops/restore-tests/run-restore-checks.sh gitea \
|
bash /mnt/user/services/homelab-infra/ops/restore-tests/run-restore-checks.sh gitea \
|
||||||
> /mnt/user/backups/restore-reports/gitea-$(date +%F).md
|
> /mnt/user/backups/restore-reports/gitea-$(date +%F).md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ V1-Inhalt:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
bash /mnt/user/services/homelab/ops/restore-tests/run-restore-checks.sh paperless \
|
bash /mnt/user/services/homelab-infra/ops/restore-tests/run-restore-checks.sh paperless \
|
||||||
> /mnt/user/backups/restore-reports/paperless-$(date +%F).md
|
> /mnt/user/backups/restore-reports/paperless-$(date +%F).md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ Beispiel:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
bash /mnt/user/services/homelab/ops/restore-tests/run-restore-job-with-ntfy.sh freshness homelab-restore
|
bash /mnt/user/services/homelab-infra/ops/restore-tests/run-restore-job-with-ntfy.sh freshness homelab-restore
|
||||||
```
|
```
|
||||||
|
|
||||||
Verwendete Hilfsskripte:
|
Verwendete Hilfsskripte:
|
||||||
|
|||||||
@@ -24,26 +24,35 @@ add_result() {
|
|||||||
parse_compose() {
|
parse_compose() {
|
||||||
local compose="$1"
|
local compose="$1"
|
||||||
awk '
|
awk '
|
||||||
|
function clean(value) {
|
||||||
|
gsub(/\r/, "", value)
|
||||||
|
gsub(/["'\''"]/, "", value)
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
function emit() {
|
||||||
|
if (service && image) {
|
||||||
|
print clean(container) "\t" clean(image)
|
||||||
|
}
|
||||||
|
}
|
||||||
/^ [A-Za-z0-9_.-]+:/ {
|
/^ [A-Za-z0-9_.-]+:/ {
|
||||||
|
emit()
|
||||||
service=$1
|
service=$1
|
||||||
sub(/:$/, "", service)
|
sub(/:$/, "", service)
|
||||||
image=""
|
image=""
|
||||||
container=service
|
container=service
|
||||||
|
next
|
||||||
}
|
}
|
||||||
service && /^ image:/ {
|
service && /^ image:/ {
|
||||||
image=$2
|
image=$0
|
||||||
gsub(/["'\'']/, "", image)
|
sub(/^[[:space:]]*image:[[:space:]]*/, "", image)
|
||||||
|
next
|
||||||
}
|
}
|
||||||
service && /^ container_name:/ {
|
service && /^ container_name:/ {
|
||||||
container=$2
|
container=$0
|
||||||
gsub(/["'\'']/, "", container)
|
sub(/^[[:space:]]*container_name:[[:space:]]*/, "", container)
|
||||||
}
|
next
|
||||||
service && image && container {
|
|
||||||
print container "\t" image
|
|
||||||
service=""
|
|
||||||
image=""
|
|
||||||
container=""
|
|
||||||
}
|
}
|
||||||
|
END { emit() }
|
||||||
' "$compose"
|
' "$compose"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ send_event() {
|
|||||||
|
|
||||||
printf '%s %s\n' "$timestamp" "$line" | tee -a "$OUTPUT_PATH" >/dev/null
|
printf '%s %s\n' "$timestamp" "$line" | tee -a "$OUTPUT_PATH" >/dev/null
|
||||||
|
|
||||||
if [ "$SEND_NTFY" = "1" ] && [ -x "$NTFY_SCRIPT" ]; then
|
if [ "$SEND_NTFY" = "1" ] && [ -f "$NTFY_SCRIPT" ]; then
|
||||||
"$NTFY_SCRIPT" "$NTFY_TOPIC" "Docker critical event" "$line" high || true
|
bash "$NTFY_SCRIPT" "$NTFY_TOPIC" "Docker critical event" "$line" high || true
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
# Unraid User Scripts fuer Posture-Checks
|
||||||
|
|
||||||
|
Host-Repo-Pfad:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/mnt/user/services/homelab-infra
|
||||||
|
```
|
||||||
|
|
||||||
|
## `posture-check-at-start`
|
||||||
|
|
||||||
|
Zeit: Array Start.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
bash /mnt/user/services/homelab-infra/services/posture-check/posture-check.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## `posture-check-hourly`
|
||||||
|
|
||||||
|
Zeit: stuendlich.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
bash /mnt/user/services/homelab-infra/services/posture-check/posture-check.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## `cert-token-check-daily`
|
||||||
|
|
||||||
|
Zeit: taeglich, z. B. 06:10.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
bash /mnt/user/services/homelab-infra/services/posture-check/cert-token-check.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## `compose-runtime-drift-daily`
|
||||||
|
|
||||||
|
Zeit: taeglich, z. B. 06:20.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
bash /mnt/user/services/homelab-infra/services/posture-check/compose-runtime-drift.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## `docker-critical-events-at-start`
|
||||||
|
|
||||||
|
Zeit: Array Start. Dieser Job startet einen Hintergrund-Watcher und beendet sich sofort.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
pgrep -f "docker events --filter event=die --filter event=oom --filter event=kill" >/dev/null && exit 0
|
||||||
|
nohup bash /mnt/user/services/homelab-infra/services/posture-check/docker-critical-events.sh \
|
||||||
|
>/mnt/user/services/posture-check/docker-critical-events.out 2>&1 </dev/null &
|
||||||
|
```
|
||||||
|
|
||||||
Reference in New Issue
Block a user