-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a scp command #120
Comments
Good idea, or even rsync! 👍 |
FWIW, here's my current workaround: function tug () {
local info
info=`tugboat info "$1"` || return 1
awk '/IP:/ { print $2 }' <<<"${info}"
}
function tugpath () {
case "$1" in
*:*)
local ip
ip=`tug "${1%:*}"` || return 1
echo "root@${ip}:${1#*:}"
;;
*)
echo "$1"
esac
}
function tugscp () {
local from to
from=`tugpath "$1"` || return 1
to=`tugpath "$2"` || return 1
scp "${from}" "${to}"
} Goes well with a somewhat lenient ssh config, shown here with what is presumably the London data centre IP range:
Works both for uploads and downloads:
|
@petems: You may find e.g. Ubuntu 10.04 LTS doesn't ship with rsync:
Nevertheless, a native rsync command would be great, too:
|
BTW I would opt for not using Ubuntu 10.04 LTS anymore ... |
My wrapper looks like this: #!/bin/bash
function tug-remove-ssh-config(){
local NAME=$1
if test -z "$NAME"; then echo "no name given"; return 1; fi
sed "\|# ${NAME}|,+3 d" ~/.ssh/config-digitalocean
}
function tug-add-ssh-config(){
local NAME=$1
local IP=$2
if test -z "$NAME"; then echo "no name given"; return 1; fi
if test -z "$IP"; then echo "no ip given"; return 1; fi
# if you add lines here, remember to remove them in tug-tug-remove-ssh-config()
cat <<EOF > ~/.ssh/config-digitalocean
# $NAME $(date)
Host $NAME
HostName $IP
User root
EOF
}
function tug-create(){
local NAME=$1
if test -z "$NAME"; then echo "no name given"; return 1; fi
tugboat create $NAME -i SOMEID -r 10 -k SOMESSHKEY
tugboat wait $NAME
local IP=$(tugboat info $NAME | awk '/IP:/ { print $2 }')
tug-remove-ssh-config $NAME
tug-add-ssh-config $NAME $IP
}
alias tug-ssh="ssh -F ~/.ssh/config-digitalocean"
alias tug-scp="scp -F ~/.ssh/config-digitalocean" The benefit of aliasing ssh instead of using The drawback is it only works for droplets created by the script a.t.m.. |
+1 |
This probably the next big feature I want to work on, I might have some free time over the christmas period so hopefully I'll be able to give it some time over December! 👍 |
Only took over 3 years but initial minimal version of the feature has been added here! #291 |
It would be great to be easily able to scp files to droplets.
The text was updated successfully, but these errors were encountered: