Commit 4fe6a529 authored by Caughlin Bohn's avatar Caughlin Bohn
Browse files

Web Update for idle

parent 690ac2d0
......@@ -17,8 +17,8 @@
netBright<0-100>-workBright<0-100>-worker1<1/0>
-->
<div class="column"><h2>Pre-Defined Actions:</h2>
<button onclick="setCookie('lights','100-100',365)">All On</button>
<button onclick="setCookie('lights','00-00',365)">All Off</button>
<button onclick="setCookie('job','ION',365)">Idle On</button>
<button onclick="setCookie('job','IOFF',365)">Idle Off</button>
</div>
</div>
<div class="column"><br/>
......@@ -41,6 +41,7 @@ netBright<0-100>-workBright<0-100>-worker1<1/0>
<h2>Jobs:</h2>
<button onclick="setCookie('job','HTC',365)">HTC Job Submit</button>
<button onclick="setCookie('job','HPC',365)">HPC Job Submit</button>
<button onclick="setCookie('job','start',365)">Start Workers</button>
</br></br></br></br></br></br></br></br></br></br>
</div>
</div>
......
......@@ -10,18 +10,33 @@
$file = fopen($filename, "a");
fwrite($file, $_COOKIE[$cookie_name]);
fclose($file);
if ($_COOKIE[$job_name] == "start"){
for ($x=1; $x<=8;$x++){
exec("sudo -H -u pi bash -c \"ssh -i ~pi/LegionKey worker".(string)$x." 'screen -md python /work/LightPi.py'\"");}
exec("sudo -H -u pi bash -c \"ssh -i ~pi/LegionKey 192.168.1.1 'screen -md python /work/idleControl.py'\"");
exec("sudo -H -u pi bash -c \"ssh -i ~pi/LegionKey 192.168.1.5 'screen -md python /work/idleControl.py'\"");
exec("sudo -H -u pi bash -c \"ssh -i ~pi/LegionKey 192.168.1.6 'screen -md python /work/idleNet.py'\"");
}
if ($_COOKIE[$job_name] == "HPC"){
$random = (string)rand(5,30);
exec("cd /work/; sudo -H -u pi bash -c \"sbatch /work/master.sh\"");
exec("cd /work/; sudo -H -u pi bash -c \"python /work/HPCWeb.py\"");
}
if ($_COOKIE[$job_name] == "HTC"){
for ($x = 0; $x < 20; $x++){
exec("cd /work/; sudo -H -u pi bash -c \"sbatch --export=A=".(string)rand(5,30)." /work/slurmMock.sh\"" );
}
exec("cd /work/; sudo -H -u pi bash -c \"python /work/HTCWeb.py\"" );
}
if ($_COOKIE[$job_name] == "ION"){
exec("sudo -H -u pi bash -c \"bash /work/idleOn.sh\"");
}
if ($_COOKIE[$job_name] == "IOFF"){
exec("sudo -H -u pi bash -c \"bash /work/idleOff.sh\"");
}
?>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment