mirror of
https://github.com/unraid/webgui.git
synced 2026-04-26 04:11:12 -05:00
Plugin system update
This commit is contained in:
@@ -18,11 +18,12 @@ function pgrep($proc) {
|
||||
return exec("pgrep -f $proc");
|
||||
}
|
||||
|
||||
if (!empty($_POST['kill']) && $_POST['kill'] > 1) {
|
||||
if (isset($_POST['kill']) && $_POST['kill'] > 1) {
|
||||
exec("kill ".$_POST['kill']);
|
||||
die;
|
||||
}
|
||||
|
||||
$start = isset($_POST['start']) && $_POST['start'] == 1;
|
||||
[$command,$args] = explode(' ',unscript($_POST['cmd']??''),2);
|
||||
|
||||
// find absolute path of command
|
||||
@@ -35,11 +36,11 @@ if ($command && strncmp($name,$path,strlen($path))===0) {
|
||||
if (isset($_POST['pid'])) {
|
||||
// return running pid
|
||||
$pid = pgrep($name);
|
||||
} elseif (!pgrep($name)) {
|
||||
// only execute when command and valid path is given and command not already running
|
||||
} elseif ($start or !pgrep($name)) {
|
||||
// start command in background and return pid
|
||||
exec("echo \"$name $args\" | at -M now >/dev/null 2>&1");
|
||||
usleep(5000);
|
||||
$pid = pgrep($name); // started
|
||||
$pid = pgrep($name);
|
||||
}
|
||||
}
|
||||
echo $pid;
|
||||
|
||||
Reference in New Issue
Block a user