Last active
August 29, 2015 13:57
-
-
Save tkuchiki/9388153 to your computer and use it in GitHub Desktop.
ssh 活用
This file contains 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
# ローカルファイルを圧縮したものを、リモートサーバに直接送る | |
tar -cz /path/to/{dir,file} | ssh your_server "cat /path/to/file.tar.gz" | |
# ローカルのシェルスクリプトをリモートサーバで実行 | |
cat << EOF | ssh REMOTE_HOST "bash" | |
hostname | |
/sbin/ifconfig | |
EOF | |
# ヒアドキュメントのネスト | |
cat << EOF | ssh REMOTE_HOST "bash" | |
cat <<'EOC' > /path/to/remote/host/file | |
remote host | |
${1} | |
EOC | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment