467363d651
Made-with: Cursor
16 lines
475 B
Bash
Executable File
16 lines
475 B
Bash
Executable File
#!/bin/bash
|
|
# Deploy tracked web files from repo -> /var/www/html (ไม่ลบ node_modules บนเซิร์ฟเวอร์)
|
|
set -euo pipefail
|
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
SRC="$REPO/www/html/"
|
|
DST="/var/www/html/"
|
|
if [[ "$(id -u)" -ne 0 ]]; then
|
|
echo "Run as root: sudo $0" >&2
|
|
exit 1
|
|
fi
|
|
rsync -a \
|
|
--exclude 'node_modules' \
|
|
"$SRC" "$DST"
|
|
chown -R www-data:www-data "$DST"
|
|
echo "OK: deployed $SRC -> $DST (node_modules on server untouched)"
|