mirror of
https://github.com/unraid/webgui.git
synced 2026-04-29 22:39:20 -05:00
30 lines
915 B
PHP
Executable File
30 lines
915 B
PHP
Executable File
#!/usr/bin/php -q
|
|
<?PHP
|
|
/* Copyright 2005-2025, Lime Technology
|
|
* Copyright 2012-2025, Bergware International.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*/
|
|
?>
|
|
<?
|
|
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
|
|
|
|
require_once "$docroot/webGui/include/publish.php";
|
|
|
|
while (true) {
|
|
$output = shell_exec("docker stats --no-stream --format='{{.ID}};{{.CPUPerc}};{{.MemUsage}}' 2>&1");
|
|
|
|
// continually publish and abort if no listeners
|
|
publish("dockerload", $output,1,true);
|
|
if ( $output === null ) {
|
|
// slow down publishing if no containers are running
|
|
sleep(10);
|
|
} else {
|
|
sleep(1);
|
|
}
|
|
}
|