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
e4eec971
Unverified
Commit
e4eec971
authored
May 27, 2019
by
David Beniamine
Browse files
Try all ip associated to a mac in DHCP lease
parent
f23054ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
registry/scripts/upgrade_all.sh
View file @
e4eec971
...
...
@@ -18,9 +18,9 @@
mainlog
=
"/var/log/
`
basename
$0
`
_
`
date
+%Y%m%d-%H%M
`
"
getip
(){
getip
s
(){
awk
'/^lease/{IP=$2} /hardware ethernet/{gsub(";","",$3);if($3 == "'
$1
'"){print IP}}'
\
< /var/lib/dhcp/dhcpd.leases |
tail
-n
1
< /var/lib/dhcp/dhcpd.leases |
sort
-u
}
runcmd
(){
...
...
@@ -59,7 +59,7 @@ done < $conf_file
log
"Wakeonlan sent, waiting"
while
[
$wait_time
-gt
0
]
do
log
-ne
"Waiting for boot, remaining
$wait_time
seconds
\r
"
|
tee
$mainlog
log
-ne
"Waiting for boot, remaining
$wait_time
seconds
\r
"
sleep
$wait_step
wait_time
=
$((
$wait_time
-
$wait_step
))
done
...
...
@@ -67,12 +67,17 @@ log -e "\nWaiting finished"
for
mac
in
$MACS
do
ip
=
$(
getip
$mac
)
runcmd
$ip
$cmd
&
PIDS
=
"
$PIDS
$!
"
for
ip
in
$(
getips
$mac
)
do
runcmd
$ip
$cmd
&
PIDS
=
"
$PIDS
$!
"
done
done
# wait all pids
wait
$PIDS
for
pid
in
$PIDS
do
wait
$pid
done
# Retrieving logs
for
f
in
/tmp/
$$
-
*
...
...
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