ops: paivana and caddy config refresh
This commit is contained in:
parent
d8dbc6242b
commit
56f814a6de
74 changed files with 4517 additions and 79 deletions
39
scripts/notes/status.sh
Executable file
39
scripts/notes/status.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
# Thin status for SilverBullet stack on koopa (hernani). Safe read-only.
|
||||
# bash scripts/notes/status.sh
|
||||
set -euo pipefail
|
||||
|
||||
OLD_DIR="${HOME}/koopa-freenotes"
|
||||
NEW_DIR="${HOME}/koopa-silverbullet"
|
||||
OLD_CT=koopa-freenotes
|
||||
NEW_CT=koopa-silverbullet
|
||||
OLD_IMG=localhost/koopa-freenotes:cachyos
|
||||
NEW_IMG=localhost/koopa-silverbullet:cachyos
|
||||
PORT=9028
|
||||
|
||||
echo "STATUS=host HOST=$(hostname -s)"
|
||||
echo "STATUS=dirs OLD=$([ -d "$OLD_DIR" ] && echo 1 || echo 0) NEW=$([ -d "$NEW_DIR" ] && echo 1 || echo 0)"
|
||||
|
||||
if command -v podman >/dev/null 2>&1; then
|
||||
ct_old=$(podman ps -a --format '{{.Names}} {{.Status}}' 2>/dev/null | grep -E "^${OLD_CT} " || true)
|
||||
ct_new=$(podman ps -a --format '{{.Names}} {{.Status}}' 2>/dev/null | grep -E "^${NEW_CT} " || true)
|
||||
echo "STATUS=ct_old ${ct_old:-none}"
|
||||
echo "STATUS=ct_new ${ct_new:-none}"
|
||||
img_old=$(podman images -q "$OLD_IMG" 2>/dev/null || true)
|
||||
img_new=$(podman images -q "$NEW_IMG" 2>/dev/null || true)
|
||||
echo "STATUS=img_old ${img_old:-none}"
|
||||
echo "STATUS=img_new ${img_new:-none}"
|
||||
else
|
||||
echo "STATUS=podman missing"
|
||||
fi
|
||||
|
||||
code=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 3 "http://127.0.0.1:${PORT}/" 2>/dev/null || echo fail)
|
||||
echo "STATUS=local_http PORT=$PORT CODE=$code"
|
||||
|
||||
if [[ -d "$NEW_DIR" ]]; then
|
||||
echo "STATUS=cutover done DIR=$NEW_DIR"
|
||||
elif [[ -d "$OLD_DIR" ]]; then
|
||||
echo "STATUS=cutover pending DIR=$OLD_DIR NEXT=cutover-to-silverbullet.sh"
|
||||
else
|
||||
echo "STATUS=cutover unknown (no live dir)"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue