Skip to content

Instantly share code, notes, and snippets.

@ykocaman
Created July 9, 2018 14:14
Show Gist options
  • Save ykocaman/eaa542b4d5d7e4627a7cabcbb7410f1e to your computer and use it in GitHub Desktop.
Save ykocaman/eaa542b4d5d7e4627a7cabcbb7410f1e to your computer and use it in GitHub Desktop.
#!/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