#!/usr/bin/env bash # Dev helper: copy this checkout to a slave's ~/.dsh/plugins/dsh-remote and restart its dsh. # deploy/push-slave.sh agent@192.168.0.110 set -euo pipefail HOST="${1:?usage: push-slave.sh user@host}" DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" O=(-o BatchMode=yes -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR) tar --exclude=.git --exclude=node_modules -C "$DIR" -czf - . | timeout 20 ssh "${O[@]}" "$HOST" \ 'mkdir -p ~/.dsh/plugins/dsh-remote && tar -xzf - -C ~/.dsh/plugins/dsh-remote' timeout 45 ssh "${O[@]}" "$HOST" 'export PATH=$HOME/.local/bin:$PATH XDG_RUNTIME_DIR=/run/user/$(id -u) systemctl --user restart dsh for i in $(seq 1 40); do curl -s -m 2 -o /dev/null http://127.0.0.1:3081/ && break; sleep 0.5; done echo "slave dsh: $(systemctl --user is-active dsh)"'