File size: 713 Bytes
47ea602
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/env bash
# ssh/rsync helpers for the pod in scripts/pod.env:  pssh.sh CMD...  |  pssh.sh --push SRC DST  |  pssh.sh --pull SRC DST
set -euo pipefail
source "$(dirname "$0")/pod.env"
KEY=$HOME/.runpod/ssh/runpodctl-ssh-key
OPTS=(-i "$KEY" -p "$POD_PORT" -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=$HOME/.runpod/ssh/known_hosts -o ConnectTimeout=20 -o ServerAliveInterval=30)
if [[ "${1:-}" == --push ]]; then rsync -rlptz --no-owner --no-group --exclude .git -e "ssh ${OPTS[*]}" "$2" "root@$POD_HOST:$3"
elif [[ "${1:-}" == --pull ]]; then rsync -rlptz --no-owner --no-group --exclude .git -e "ssh ${OPTS[*]}" "root@$POD_HOST:$2" "$3"
else exec ssh "${OPTS[@]}" "root@$POD_HOST" "$@"; fi