Created
July 11, 2019 08:57
-
-
Save ReallyLiri/df97b67b6dc35185ab72f5a7834afb31 to your computer and use it in GitHub Desktop.
KubernetesRsync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# USAGE: ./krsync.sh <src> <dst> , with either src/dst dir pointing to a pod (of the format 'pod:/<path>') | |
# Check if we are running within --rsh already (remote shell) | |
if [ -z "$KRSYNC_STARTED" ]; then | |
# not using --rsh | |
export KRSYNC_STARTED=true | |
exec rsync --blocking-io --rsh "$0" -a --progress --stats $@ # re-activate the script as remote shell | |
fi | |
# Running as --rsh ! | |
pod=$1 | |
shift | |
exec kubectl exec -i $pod -- "$@" | |
unset KRSYNC_STARTED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment