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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Grenoble
eole-wol
Commits
834ffcbc
Verified
Commit
834ffcbc
authored
Aug 2, 2018
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
New version using ajax
parent
a818feb3
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/sendmac.sh
+1
-3
1 addition, 3 deletions
wol/scripts/sendmac.sh
wol/www/boot.php
+2
-13
2 additions, 13 deletions
wol/www/boot.php
wol/www/index.php
+7
-5
7 additions, 5 deletions
wol/www/index.php
with
10 additions
and
21 deletions
wol/scripts/sendmac.sh
+
1
−
3
View file @
834ffcbc
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
IP
=
$(
ip a |
awk
'/inet.*containers/ {print $2}'
|
cut
-d
/
-f
1
)
IP
=
$(
ip a |
awk
'/inet.*containers/ {print $2}'
|
cut
-d
/
-f
1
)
subnet
=
$(
ip a |
awk
'/inet.*containers/ {print $2}'
|
cut
-d
/
-f
1 |
cut
-d
.
-f
1-3
)
subnet
=
$(
ip a |
awk
'/inet.*containers/ {print $2}'
|
cut
-d
/
-f
1 |
cut
-d
.
-f
1-3
)
echo
"Demande de démarrage pour l'adresse mac :
$1
"
echo
"
$1
"
| netcat
$subnet
.52 9999
echo
"
$1
"
| netcat
$subnet
.52 9999
echo
"Démarrage en cours, attente de l'IP"
retip
=
`
netcat
-l
$IP
9999
`
retip
=
`
netcat
-l
$IP
9999
`
echo
"
Vous pouvez désormais lancer XRDP et vous connecter à l'adresse
:
$retip
"
echo
"
IP
:
$retip
"
This diff is collapsed.
Click to expand it.
wol/www/boot.php
+
2
−
13
View file @
834ffcbc
...
@@ -23,21 +23,10 @@
...
@@ -23,21 +23,10 @@
echo
"<p>Adresse MAC invalide : "
.
$args
.
"</p>"
;
echo
"<p>Adresse MAC invalide : "
.
$args
.
"</p>"
;
}
else
{
}
else
{
$cmd
=
"../scripts/sendmac.sh"
;
$cmd
=
"../scripts/sendmac.sh"
;
echo
"<p> D
e
marrage de la machine "
.
$args
.
"</p>"
;
echo
"<p> D
é
marrage de la machine "
.
$args
.
"
terminé
</p>"
;
echo
"<pre><code>"
;
echo
"<pre><code>"
;
$descriptorspec
=
array
(
0
=>
array
(
"pipe"
,
"r"
),
// stdin is a pipe that the child will read from
1
=>
array
(
"pipe"
,
"w"
),
// stdout is a pipe that the child will write to
2
=>
array
(
"pipe"
,
"w"
)
// stderr is a pipe that the child will write to
);
flush
();
$process
=
proc_open
(
"
$cmd
$args
"
,
$descriptorspec
,
$pipes
,
realpath
(
'./'
),
array
());
$process
=
proc_open
(
"
$cmd
$args
"
,
$descriptorspec
,
$pipes
,
realpath
(
'./'
),
array
());
echo
"<pre>"
;
echo
"<pre>"
;
if
(
is_resource
(
$process
))
{
shell_exec
(
"
$cmd
$args
"
);
while
(
$s
=
fgets
(
$pipes
[
1
]))
{
print
$s
;
flush
();
}
}
echo
"</code></pre>"
;
echo
"</code></pre>"
;
}
}
This diff is collapsed.
Click to expand it.
wol/www/index.php
+
7
−
5
View file @
834ffcbc
...
@@ -20,13 +20,15 @@
...
@@ -20,13 +20,15 @@
extract
(
$_POST
);
extract
(
$_POST
);
switch
(
$action
){
switch
(
$action
){
case
"wake"
:
case
"wake"
:
echo
"<div id='result'><
/
div>"
;
echo
"<div id='result'><
p>Démarrage demandé pour la machine
$mac
, veuillez patienter</p<
div>"
;
?>
?>
<script
language=
"javascript"
>
<script
language=
"javascript"
>
var
source
=
new
EventSource
(
<?php
echo
"'boot.php?mac=
$mac
'"
?>
);
$
.
ajax
({
source
.
onmessage
=
function
(
event
)
{
url
:
'
<?php
echo
"'boot.php?mac=
$mac
'"
?>
'
,
success
:
function
(
response
)
{
document
.
getElementById
(
"
result
"
).
innerHTML
+=
event
.
data
+
"
<br>
"
;
document
.
getElementById
(
"
result
"
).
innerHTML
+=
event
.
data
+
"
<br>
"
;
};
}
});
</script>
</script>
<?php
<?php
break
;
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