Last active
August 3, 2017 23:44
-
-
Save renizgo/4c39eb19e5dad6c39b2ab51e6e1348c9 to your computer and use it in GitHub Desktop.
Adiciona linha em .bash_profile em servidores remotos.
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/bash | |
## bash.sh - Copia a linha contida no arquivo bash.txt no bash_profile do usuário definido na variavel de ambiente USER, | |
## em todos os servers do documento lista.txt. | |
## Obs: um servidor por linha | |
## Escrito por: Renato Diniz Marigo | |
## E-mail: renatocabelo@gmail.com | |
## Data: 03/08/2017 | |
echo "#####################################" | |
echo "# Adicionando linha em bash_profile #" | |
echo "#####################################" | |
USER="renato.diniz" | |
for SERVER in $(cat lista.txt) | |
do | |
scp bash.txt $USER@$SERVER:/home/$USER/ | |
ssh $USER@$SERVER << COMANDOS | |
cat bash.txt >> .bash_profile | |
rm bash.txt | |
COMANDOS | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment