Skip to content

Instantly share code, notes, and snippets.

@sebastianwebber
Created November 27, 2015 12:06
Show Gist options
  • Select an option

  • Save sebastianwebber/ae33e474df1f2769e745 to your computer and use it in GitHub Desktop.

Select an option

Save sebastianwebber/ae33e474df1f2769e745 to your computer and use it in GitHub Desktop.
exemplo de scripts para rodar em servidor remoto
#!/bin/bash
DEFAULT_USER=root
DIR_SCRIPTS=/tmp
function sync_scripts() {
ssh $DEFAULT_USER@$1 mkdir -p $DIR_SCRIPTS > /dev/null 2>&1
rsync -a --partial teste.sh $DIR_SCRIPTS
}
function executa_script() {
ssh $DEFAULT_USER@$1 $DIR_SCRIPTS/$2
}
function roda_rotina() {
sync_scripts $1
executa_script $1 teste.sh
}
for ip in $(seq 3 4); do
roda_rotina 10.0.10.8$ip
done
#!/bin/bash
echo super foda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment