Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Grenoble
Eole-Wol
Commits
6dad5b84
Unverified
Commit
6dad5b84
authored
Oct 28, 2019
by
David Beniamine
Browse files
Retrieve upgrade logs and summary from all schools
parent
1ab65a48
Changes
2
Hide whitespace changes
Inline
Side-by-side
logs/extract_hosts.sh
0 → 100755
View file @
6dad5b84
#!/bin/bash
SCHOOLS
=
$(
/usr/bin/ls
*
.log |
grep
-v
"getlogs.log"
|
sed
's/\.log$//'
)
for
school
in
$SCHOOLS
do
UPDATED
=
""
FAILED
=
""
file
=
"
$school
.log"
MACS
=
$(
awk
'/^Trying/{print $5}'
$file
|
sed
-e
's/(//'
-e
's/)//'
)
for
mac
in
$MACS
do
name
=
$(
grep
"^Trying to boot .* (
$mac
)"
$file
|
cut
-d
' '
-f
4
)
host
=
"
$name
-
$mac
"
if
[
$(
grep
"Begin host
$name
(
$mac
"
-A
1
$file
|
grep
"End host
$name
"
-c
)
-eq
0
]
then
UPDATED
=
"
$UPDATED
$host
"
else
FAILED
=
"
$FAILED
$host
"
fi
done
nUpdated
=
$(
echo
$UPDATED
|
wc
-w
)
nUpdatedTot
=
$((
$nUpdatedTot
+
$nUpdated
))
nFailed
=
$(
echo
$FAILED
|
wc
-w
)
nFailedTot
=
$((
$nFailedTot
+
$nFailed
))
if
[
$nFailed
-gt
0
]
then
SCHOOLS_FAILED
=
"
$SCHOOLS_FAILED
$school
"
fi
echo
"=====================
$school
============================"
echo
"Resultats pour l'école '
$school
'"
echo
-e
"
\t
sur un total de
$((
$nUpdated
+
$nFailed
))
postes"
echo
-e
"
\t
$nUpdated
postes mis à jour (
$UPDATED
)"
echo
-e
"
\t
$nFailed
postes non contactés (
$FAILED
)"
echo
"========================================================="
done
nSchools
=
$(
echo
$SCHOOLS
|
wc
-w
)
nFailedSchools
=
$(
echo
$SCHOOLS_FAILED
|
wc
-w
)
echo
"===================== Total ============================"
echo
"Resultats globaux"
echo
-e
"
\t
sur un total de
$((
$nUpdatedTot
+
$nFailedTot
))
postes dans
$nSchools
écoles"
echo
-e
"
\t
$nUpdatedTot
postes mis à jour"
echo
-e
"
\t
$nFailedTot
postes non contactés dans
$nFailedSchools
écoles (
$SCHOOLS_FAILED
)"
echo
"========================================================="
logs/getlogs.sh
0 → 100755
View file @
6dad5b84
#!/bin/bash
ECOLES
=
"alphonse-daudet ampere anatole-france anthoard bajatiere beauvert bizanet christophe-turc-vm christophe-turc-vo clemenceau diderot elisee-chatin ferdinand-buisson grand-chatelet houille-blanche jean-jaures joseph-vallier jules-ferry fontaine lac verderet leon-jouhaux buttes trembles liberation lucie-aubrac malherbe menon-sg menon-sh nicolas-chorier paul-bert paul-painleve saint-laurent sidi-brahim simone-lagrange"
for
e
in
$ECOLES
do
echo
"Retrieving logs for
$e
"
file
=
$(
ssh
-o
"StrictHostKeyChecking=no"
root@
$e
.ecole.grenoble.fr
\
ssh partage
ls
-ltr
/var/log/ |
grep
'upgrade_all'
\
|
tail
-n
1 | rev |
cut
-d
' '
-f
1 | rev
)
ssh
-o
"StrictHostKeyChecking=no"
root@
$e
.ecole.grenoble.fr ssh partage
cat
/var/log/
$file
>
$e
.log
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment