Add updateDockerImages.sh updateYtdlpForVideoTranslation.sh

This commit is contained in:
2026-04-13 16:22:50 +08:00
parent 29f98e9a78
commit cc179680f0
2 changed files with 78 additions and 0 deletions

40
updateDockerImages.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
echo "[$(date '+%F %T')] Starting updateDockerImages.sh"
BASE="/DATA01/dockers"
SERVICES=(adguardhome caddy filebrowser freshrss gitea immich nextcloud storj)
# require Docker Compose v2 (`docker compose`)
if ! docker compose version >/dev/null 2>&1; then
echo "docker compose (v2) not available. Install/enable it." >&2
exit 1
fi
run_compose() {
docker compose "$@"
}
for svc in "${SERVICES[@]}"; do
dir="$BASE/$svc"
if [ ! -d "$dir" ]; then
echo "Skipping $svc: directory not found: $dir"
continue
fi
echo "==> Updating $svc (dir: $dir)"
pushd "$dir" >/dev/null || { echo "pushd failed for $dir" >&2; continue; }
# stop if desired (warning only)
run_compose down || echo "Warning: 'down' failed for $svc"
# pull then bring up (handle per-service failures and continue)
run_compose pull || { echo "Error: 'pull' failed for $svc" >&2; popd >/dev/null; continue; }
run_compose up -d || { echo "Error: 'up -d' failed for $svc" >&2; popd >/dev/null; continue; }
popd >/dev/null
done
echo "[$(date '+%F %T')] Finished updateDockerImages.sh"