auto up 00:25:23 up 0:33, 2 users, load average: 2.30, 1.18, 0.88

This commit is contained in:
2025-11-02 00:25:24 +01:00
parent a0b2186b1a
commit 45397093c8

View File

@@ -12,8 +12,12 @@ REPOS=(
# Commit message # Commit message
COMMIT_MSG="auto up $(uptime)" COMMIT_MSG="auto up $(uptime)"
# Temporary file for logging statuses
TMP_LOG=$(mktemp)
process_repo() { process_repo() {
local repo="$1" local repo="$1"
local status="ok"
if [ -d "$repo/.git" ]; then if [ -d "$repo/.git" ]; then
echo "Processing $repo..." echo "Processing $repo..."
@@ -22,12 +26,18 @@ process_repo() {
git fetch git fetch
git add . git add .
git commit -m "$COMMIT_MSG" >/dev/null 2>&1 || true git commit -m "$COMMIT_MSG" >/dev/null 2>&1 || true
git pull --rebase if ! git pull --rebase; then
git push status="conflict"
echo "Done: $repo" else
git push || status="push-failed"
fi
echo "$repo:$status" >>"$TMP_LOG"
echo "Done: $repo ($status)"
) )
else else
echo "Skipping $repo: not a git repository" echo "Skipping $repo: not a git repository"
echo "$repo:skipped" >>"$TMP_LOG"
fi fi
} }
@@ -37,3 +47,22 @@ done
wait wait
echo "All repositories processed." echo "All repositories processed."
echo
# Summarize results
echo "=== Summary ==="
if grep -q "conflict" "$TMP_LOG"; then
grep "conflict" "$TMP_LOG" | while IFS=: read -r repo _; do
echo "⚠️ Conflict detected in: $repo"
done
else
echo "No conflicts detected."
fi
if grep -q "push-failed" "$TMP_LOG"; then
grep "push-failed" "$TMP_LOG" | while IFS=: read -r repo _; do
echo "⚠️ Push failed for: $repo"
done
fi
rm -f "$TMP_LOG"