467363d651
Made-with: Cursor
20 lines
564 B
Bash
Executable File
20 lines
564 B
Bash
Executable File
#!/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."
|