This commit is contained in:
Chris Wanstrath 2025-09-16 20:41:17 -07:00
parent da1bb3f29a
commit d06f9f62df

View File

@ -7,12 +7,21 @@ set -euo pipefail
HOST="chris@nose-pluto.local" HOST="chris@nose-pluto.local"
DEST="~/pluto" DEST="~/pluto"
SOCK="$HOME/.ssh/cm-%r@%h:%p"
# sync (skip node_modules and .git) # 1) Open a master connection (prompts once)
ssh -MNf -o ControlMaster=yes -o ControlPersist=120 \
-o ControlPath="$SOCK" "$HOST"
# 2) rsync (reuses the connection)
rsync -az --delete \ rsync -az --delete \
-e "ssh -o ControlPath=$SOCK" \
--exclude 'node_modules/' \ --exclude 'node_modules/' \
--exclude '.git/' \ --exclude '.git/' \
./ "$HOST:$DEST/" ./ "$HOST:$DEST/"
# install deps + restart service # 3) remote install (reuses the connection)
ssh "$HOST" 'cd ~/pluto && bun install --frozen-lockfile && sudo systemctl restart nose-pluto.service' ssh -o ControlPath="$SOCK" "$HOST" "cd $DEST && bun install --frozen-lockfile && sudo systemctl restart nose-pluto.service"
# 4) close the master connection
ssh -O exit -o ControlPath="$SOCK" "$HOST"