#!/bin/bash # ดึง /var/www/html เข้า repo (ไม่รวม node_modules) แล้ว commit + push set -euo pipefail REPO="$(cd "$(dirname "$0")/.." && pwd)" MSG="${1:-Sync www/html from server}" mkdir -p "$REPO/www" rsync -a \ --exclude 'node_modules' \ --exclude '.git' \ /var/www/html/ "$REPO/www/html/" cd "$REPO" git add -A www/html nginx scripts README.md .gitignore if git diff --cached --quiet; then echo "No changes to commit." exit 0 fi git commit -m "$MSG" git push origin main echo "OK: www/html synced, committed, pushed."