Created
July 9, 2018 14:14
-
-
Save ykocaman/eaa542b4d5d7e4627a7cabcbb7410f1e to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -e; | |
############################## | |
#### Tanimlamalar | |
############################# | |
ssh_user='vagrant'; | |
ssh_port=22; | |
servers=( | |
vagrant | |
vagrant | |
); | |
local_file='/tmp/test.csv'; | |
remote_file='/tmp/test.csv'; | |
remote_command="touch /tmp/test"; | |
############################## | |
#### END Tanimlamalar | |
############################# | |
remote_run(){ | |
ssh -p $ssh_port $ssh_user@$server $1; | |
} | |
remote_copy(){ | |
scp -P $ssh_port $1 $ssh_user@$server:$2; | |
} | |
for server in ${servers[*]} | |
do | |
remote_copy $local_file $remote_file; | |
remote_run "$remote_command"; | |
remote_run "rm $remote_file"; | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment