-
Notifications
You must be signed in to change notification settings - Fork 0
/
webstress.php
40 lines (40 loc) · 912 Bytes
/
webstress.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<head>
<title>Stress Test</title>
</head>
<body>
<?php
$PID = exec("pidof stress");
$stresskill = $_GET["stress"];
if (strlen($stresskill) > 0) {
if ($stresskill == "start") {
echo("<h2>Generating Load</h2>");
exec("stress --cpu 4 --io 1 --vm 1 --vm-bytes 128M > /dev/null 2>/dev/null &");
} elseif ($stresskill == "stop") {
echo("<h2>Killed stress</h2>");
exec("kill -9 $PID");
} else {}
}
?>
<center>
<h2>Generate Load</h2>
<table>
<tr>
<td>
<form action="index.php">
<input type="hidden" name="stress" value="start" />
<input type="submit" value="Start Stress" />
</form>
</td>
<td>
<form>
<input type="hidden" name="stress" value="stop" />
<input type="submit" value="Stop Stress" />
</form>
</td>
</tr>
</table>
</center>
</body>
</html>