Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
eole-wol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
primtux-eole
Plan de cuques
eole-wol
Commits
91c5c7d5
Verified
Commit
91c5c7d5
authored
6 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
Multiple fix by removing timeouts as much as possible
parent
a43d0cbf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
wol/scripts/wakeonlanservice.sh
+5
-15
5 additions, 15 deletions
wol/scripts/wakeonlanservice.sh
wol/www/boot.php
+14
-9
14 additions, 9 deletions
wol/www/boot.php
wol/www/index.php
+5
-2
5 additions, 2 deletions
wol/www/index.php
with
24 additions
and
26 deletions
wol/scripts/wakeonlanservice.sh
+
5
−
15
View file @
91c5c7d5
...
...
@@ -24,27 +24,17 @@ getip(){
IP
=
$(
ip a |
awk
'/inet.*containers/ {print $2}'
|
cut
-d
/
-f
1
)
broadcast
=
$(
ip a |
awk
'/inet.*eth1/ {print $4}'
|
cut
-d
/
-f
1
)
subnet
=
$(
ip a |
awk
'/inet.*containers/ {print $2}'
|
cut
-d
/
-f
1 |
cut
-d
.
-f
1-3
)
LIMIT
=
20
while
true
do
MAC
=
`
netcat
-l
$IP
9999
`
echo
"
$MAC
"
if
[
$(
echo
"
$MAC
"
| egrep
-c
"^([0-9a-f]{2}:?){6}$"
)
-eq
1
]
then
wakeonlan
-i
$broadcast
"
$MAC
"
bootedip
=
""
timeout
=
0
sleep
25
while
[
-z
"
$bootedip
"
]
do
bootedip
=
`
getip
$MAC
`
sleep
5
timeout
=
$((
$timeout
+
1
))
if
[
$timeout
-ge
$LIMIT
]
then
$bootedip
=
"ERROR"
break
fi
done
bootedip
=
`
getip
$MAC
`
echo
"Sending ip"
echo
"
$bootedip
"
| netcat
$subnet
.51 9999
echo
"Done"
fi
done
This diff is collapsed.
Click to expand it.
wol/www/boot.php
+
14
−
9
View file @
91c5c7d5
...
...
@@ -23,13 +23,18 @@
echo
"<p>Adresse MAC invalide : "
.
$args
.
"</p>"
;
}
else
{
$cmd
=
"../scripts/sendmac.sh"
;
$ip
=
shell_exec
(
"
$cmd
$args
"
);
if
(
!
empty
(
trim
(
$ip
))){
echo
"<p> Démarrage de la machine "
.
$args
.
" terminé !</p>"
;
echo
"<p>Pour vous y connecter, téléchargez "
;
system
(
"cp www/config.rdp.sample www/config.rdp"
);
system
(
"echo
\"
full address:s:
\"
"
.
$_SERVER
[
"HTTP_HOST"
]
.
" >> config.rdp"
);
echo
'<a href="config.rdp'
;
echo
'">ce fichier</a> et lancez le.<br />'
;
echo
"Cela ouvrira XRDP, il vous suffira alors d'indiquer l'adresse IP <span style='color:blue;font-weight:bold'>"
.
shell_exec
(
"
$cmd
$args
"
)
.
"</span>"
;
echo
"Cela ouvrira XRDP, il vous suffira alors d'indiquer l'adresse IP <span style='color:blue;font-weight:bold'>"
.
$ip
.
"</span>"
;
echo
"et le mot de passe adéquat"
;
echo
"</p>"
;
}
else
{
header
(
'HTTP/1.1 500 Internal Server Error'
);
}
}
This diff is collapsed.
Click to expand it.
wol/www/index.php
+
5
−
2
View file @
91c5c7d5
...
...
@@ -41,10 +41,13 @@
type
:
"
POST
"
,
data
:
'
<?php
echo
"mac=
$mac
"
?>
'
,
url
:
'
boot.php
'
,
timeout
:
6
0000
,
timeout
:
3
0000
,
error
:
function
(
reponse
){
if
(
retry
>
0
){
$
(
"
#result
"
).
html
(
"
Veuillez patienter encore un peu (max
"
+
retry
*
4
+
"
sec)
"
)
;
sendpost
(
retry
-
1
);
}
else
{
$
(
"
#result
"
).
html
(
"
Erreur : IP non trouvée après 120 secondes
"
)
;
}
},
success
:
function
(
response
)
{
...
...
@@ -52,7 +55,7 @@
}
});
}
sendpost
(
1
);
sendpost
(
24
);
</script>
<?php
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment