add antendance

This commit is contained in:
nik
2025-09-22 22:41:00 +03:00
parent ae3f1c301e
commit adcb77aa47
3 changed files with 120 additions and 7 deletions

View File

@@ -2,11 +2,8 @@
set -euo pipefail
HOST="${1:-}"
DEST="${2:-}"
TMP="/tmp/masha_site_$(date +%s)"
mkdir -p "$TMP"
cp -a index.html "$TMP/index.html"
ssh -o StrictHostKeyChecking=no "$HOST" "mkdir -p '$DEST'"
scp -q "$TMP/index.html" "$HOST":"$DEST/.index.html.new"
ssh -o StrictHostKeyChecking=no "$HOST" "mv '$DEST/.index.html.new' '$DEST/index.html'"
rm -rf "$TMP"
TMP="$DEST.new"
ssh -o StrictHostKeyChecking=no "$HOST" "rm -rf '$TMP' && mkdir -p '$TMP'"
tar -cz --exclude .git --exclude Jenkinsfile --exclude deploy -C . . | ssh -o StrictHostKeyChecking=no "$HOST" "tar -xz -C '$TMP'"
ssh -o StrictHostKeyChecking=no "$HOST" "mkdir -p '$DEST'; rm -rf '${DEST}.prev'; mv '$DEST' '${DEST}.prev' 2>/dev/null || true; mv '$TMP' '$DEST'"