Last active
October 13, 2015 04:51
-
-
Save kurozumi/dd83118bd25592ca711f to your computer and use it in GitHub Desktop.
【シェルスクリプト】外部サーバーからCSVファイルをダウンロードしてダウンロード元のファイルを削除する方法
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
#!/bin/sh | |
USER="username" | |
PASS="password" | |
HOST="203.0.113.0" | |
PORT="22" | |
DIR="/home/user/csvfile" | |
sshpass -p "$PASS" ssh -p $PORT $USER@$HOST "cd $DIR && [ -f *.csv ]" && | |
sshpass -p "$PASS" scp -P $PORT $USER@$HOST:$DIR/*.csv /csvfile && | |
sshpass -p "$PASS" ssh -p $PORT $USER@$HOST "cd $DIR && rm *.csv" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment