mirror of
https://github.com/Ascyii/scripts.git
synced 2026-01-01 04:44:24 -05:00
auto up 00:25:23 up 0:33, 2 users, load average: 2.30, 1.18, 0.88
This commit is contained in:
35
shell/up.sh
35
shell/up.sh
@@ -12,8 +12,12 @@ REPOS=(
|
||||
# Commit message
|
||||
COMMIT_MSG="auto up $(uptime)"
|
||||
|
||||
# Temporary file for logging statuses
|
||||
TMP_LOG=$(mktemp)
|
||||
|
||||
process_repo() {
|
||||
local repo="$1"
|
||||
local status="ok"
|
||||
|
||||
if [ -d "$repo/.git" ]; then
|
||||
echo "Processing $repo..."
|
||||
@@ -22,12 +26,18 @@ process_repo() {
|
||||
git fetch
|
||||
git add .
|
||||
git commit -m "$COMMIT_MSG" >/dev/null 2>&1 || true
|
||||
git pull --rebase
|
||||
git push
|
||||
echo "Done: $repo"
|
||||
if ! git pull --rebase; then
|
||||
status="conflict"
|
||||
else
|
||||
git push || status="push-failed"
|
||||
fi
|
||||
|
||||
echo "$repo:$status" >>"$TMP_LOG"
|
||||
echo "Done: $repo ($status)"
|
||||
)
|
||||
else
|
||||
echo "Skipping $repo: not a git repository"
|
||||
echo "$repo:skipped" >>"$TMP_LOG"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -37,3 +47,22 @@ done
|
||||
|
||||
wait
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user