From 49d8165ee262a93ee645e1fa46b2f26b19bfd910 Mon Sep 17 00:00:00 2001 From: hoelee Date: Mon, 4 May 2026 09:00:00 +0800 Subject: [PATCH] chore(shell-sync): Makefile scaffolding --- platform/shell-sync/Makefile | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/platform/shell-sync/Makefile b/platform/shell-sync/Makefile index f2f7d3bd..664f01f6 100644 --- a/platform/shell-sync/Makefile +++ b/platform/shell-sync/Makefile @@ -17,3 +17,41 @@ down: logs: docker logs -f email-sync-oauth2 +# Show status of all accounts +status: + @echo "=== Container Status ===" + @docker inspect --format='Status: {{.State.Status}}' email-sync-oauth2 2>/dev/null || echo "Container not running" + @echo "" + @echo "=== Health Status ===" + @docker inspect --format='Health: {{.State.Health.Status}}' email-sync-oauth2 2>/dev/null || echo "No healthcheck" + @echo "" + @echo "=== Last Sync Times ===" + @for f in logs/*.last_success; do \ + [ -f "$$f" ] && echo "$$(basename $$f .last_success): $$(date -d @$$(cat $$f) 2>/dev/null || echo 'unknown')"; \ + done + @echo "" + @echo "=== Last Failures ===" + @for f in logs/*.last_failure; do \ + [ -f "$$f" ] && echo "$$(basename $$f .last_failure): $$(date -d @$$(cat $$f) 2>/dev/null || echo 'unknown')"; \ + done + +# Check health +health: + @docker inspect --format='{{json .State.Health}}' email-sync-oauth2 | jq + +# Authorize account (usage: make authorize ACCOUNT=1) +authorize: + @if [ -z "$(ACCOUNT)" ]; then \ + echo "Usage: make authorize ACCOUNT=1"; \ + exit 1; \ + fi + docker compose run --rm imapsync authorize $(ACCOUNT) + +# Force sync account (usage: make sync ACCOUNT=1) +sync: + @if [ -z "$(ACCOUNT)" ]; then \ + echo "Usage: make sync ACCOUNT=1"; \ + exit 1; \ + fi + docker compose exec imapsync sync.sh sync $(ACCOUNT) +