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
582cdb32
Unverified
Commit
582cdb32
authored
Jun 13, 2019
by
David Beniamine
Browse files
Improved upgrade_all loging for primtux-eole/grenoble/primtux-eole#25
parent
e4eec971
Changes
1
Hide whitespace changes
Inline
Side-by-side
registry/scripts/upgrade_all.sh
View file @
582cdb32
...
...
@@ -46,13 +46,21 @@ wait_time=120
wait_step
=
5
cmd
=
"cd /opt/primtux-eole/; export HTTPS_PROXY='http://dnsproxy:3128'; git pull; ./upgrade-session.sh
$1
"
declare
-A
HOSTS
declare
-A
IPTOMACS
declare
-A
DOWNS
while
read date
mac name
do
# Boot machine
log
"Trying to boot
$mac
"
wakeonlan
-i
$broadcast
"
$mac
"
MACS+
=
"
$mac
"
if
[
!
-z
"
$date
"
]
then
HOSTS[
$mac
]=
$name
log
"Trying to boot
$name
(
$mac
)"
wakeonlan
-i
$broadcast
"
$mac
"
sleep
5
MACS+
=
"
$mac
"
fi
done
<
$conf_file
# Wait for boot
...
...
@@ -65,10 +73,12 @@ do
done
log
-e
"
\n
Waiting finished"
# Running command
for
mac
in
$MACS
do
for
ip
in
$(
getips
$mac
)
do
IPTOMACS[
$ip
]=
$mac
runcmd
$ip
$cmd
&
PIDS
=
"
$PIDS
$!
"
done
...
...
@@ -82,9 +92,27 @@ done
# Retrieving logs
for
f
in
/tmp/
$$
-
*
do
host
=
$(
echo
$f
|
cut
-d
'-'
-f
2-
)
log
"===== Begin host
$host
===="
ip
=
$(
echo
$f
|
cut
-d
'-'
-f
2- |
sed
's/\.log$//'
)
mac
=
${
IPTOMACS
[
$ip
]
}
name
=
${
HOSTS
[
$mac
]
}
log
"===== Begin host
$name
(
$mac
-
$ip
) ===="
cat
$f
>>
$mainlog
log
"===== End host
$host
===="
log
"===== End host
$name
===="
if
[
$(
wc
-l
$f
|
awk
'{print $1}'
)
-gt
0
]
then
DOWNS[
$mac
]=
$name
fi
done
# Listing down hosts
if
[
${#
DOWNS
[@]
}
-eq
0
]
then
log
"All
${#
HOSTS
[@]
}
hosts answered"
else
log
"On a total of
${#
HOSTS
[@]
}
hosts,
${#
DOWNS
[@]
}
are still down:"
for
mac
in
${
!DOWNS[@]
}
do
log
-e
"
\t
*
${
DOWNS
[
$mac
]
}
(
$mac
)"
done
fi
log
"Output written to
$mainlog
"
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