Created
March 2, 2012 10:04
-
-
Save leon/1957476 to your computer and use it in GitHub Desktop.
ssh-copy-rsub - allows you to easily copy the remote script to your server using the same syntax as ssh-copy-id
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/sh -e | |
# | |
# Usage: ssh-copy-rsub [--bash] [user@]machine | |
# | |
# Shell script to install rsub on the remove server so we can open shell scripts locally. | |
# Author: Leon Radley (http://github.com/leon) | |
URL="https://raw.github.com/avian/rmate/master/rmate" | |
if [ "$#" -gt 1 ] || [ "$1" = "-b" ] || [ "$1" = "--bash" ]; then | |
shift | |
URL="https://raw.github.com/aurora/rmate/master/rmate" | |
fi | |
if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | |
cat <<EOF | |
Usage: $0 [--bash] [user@]machine | |
# Install Sublime Text plugin | |
https://github.com/Drarok/rsub | |
# Setup ssh for easy access | |
edit ~/.ssh/config | |
# The automatic forwarding | |
RemoteForward 52698 localhost:52698 | |
# Standard user, so you can do ssh servername instead of root@servername | |
User root | |
# Custom aliases | |
Host myalias | |
HostName myserver.mydomain.com | |
User myuser | |
EOF | |
exit 1 | |
fi | |
wget --quiet -O - "${URL}" | ssh ${1%:} 'umask 077; test -d /usr/local/bin || mkdir -p /usr/local/bin; cat > /usr/local/bin/rsub; chmod a+rx /usr/local/bin/rsub' || exit 1 | |
cat <<EOF | |
Installation complete! | |
For more information run $0 --help | |
EOF |
Thanks! I've updated the gist :)
FYI, the URL for the Ruby version has changed; it's now a gem, but it could still be installed directly from https://raw.github.com/textmate/rmate/master/bin/rmate.
Don't forget to set the premissions to get it working
sudo chmod 755 /usr/local/bin/ssh-copy-rsub
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://raw.github.com/aurora/rmate/master/rmate.sh
should now behttps://raw.github.com/aurora/rmate/master/rmate