Skip to content

Instantly share code, notes, and snippets.

@richardsonlima
Last active February 10, 2016 19:10
Show Gist options
  • Save richardsonlima/d01e62226973f45bee4d to your computer and use it in GitHub Desktop.
Save richardsonlima/d01e62226973f45bee4d to your computer and use it in GitHub Desktop.
#################################
# SCRIPT 01
#################################
#!/bin/bash
# -x for debug
#set -x
user='user'
sshport='22'
timestamp=$(date +"%d-%m-%Y")
base="/home/user/Scripts/CheckDiarioTodasMaquinas/BASE"
get="/home/user/Scripts/CheckDiarioTodasMaquinas/linux-dailycheck"
reportbase="/var/www/mediawiki/relatorio/relatorio-linux"
ssh='ssh -T -p'
createbase(){
mkdir -p $reportbase/$timestamp
cp -R $base $reportbase/$timestamp/
sudo chmod -R 775 $reportbase/$timestamp/
}
minion(){
for server in $(cat /home/user/Scripts/LINUX-SERVERS/servidores-linux.txt) ;
do
$ssh $sshport $user@$server < $get/html-report-creator-v1.sh \
| grep -vE "System load|System information as of|Documentation|Welcome to Ubuntu|Linux ubuntu-pangolim|SMP|Remova essas mensagens|Configurar|\+\-\+\-\+\-|ATENCAO|sendo auditadas|desconecte imediatamente" > $reportbase/$timestamp/$server-linux-DailyCheck-$timestamp.html ;
done
}
compact(){
cd $reportbase && /usr/bin/zip -P pass -r CheckDiario-Linux-$timestamp.zip $timestamp
}
createbase
minion
#################################
# SCRIPT 02 (html-report-creator-v1.sh)
#################################
# https://gist.github.com/richardsonlima/074cb9d5ff878e8e06dc
#################################
# SCRIPT 03 (html-mail-report-creator-v1.sh)
#################################
# https://gist.github.com/richardsonlima/43f193b61039a80afe1c
# mail-report-html-build
# https://gist.github.com/richardsonlima/78308869a7d86187e084
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment