Stop signalling on the strength of a stat file alone

A job killed hard never corrects its own record, so 'running' outlives the
process and the pid can since belong to something else; array-start jobs get
setsid too, so Stop can reach past their direct children.
This commit is contained in:
Gmer4Lfe
2026-08-08 13:50:01 -04:00
parent 2fefb56b8c
commit df3c4bb369
2 changed files with 35 additions and 4 deletions
@@ -13,6 +13,8 @@ foreach (\$s as \$id => \$e) {
: SCRIPTS_DIR . '/' . \$id;
if (!file_exists(\$script)) continue;
\$flags = !empty(\$e['log_enabled']) ? ' --log' : '';
exec('nohup bash ' . escapeshellarg(\$runner) . ' ' . escapeshellarg(\$id) . ' ' . escapeshellarg(\$script) . \$flags . ' > /dev/null 2>&1 &');
// setsid for the same reason as api/run.php: the job must lead its own process group or
// api/stop.php cannot signal the tree, only the parent and its direct children.
exec('setsid nohup bash ' . escapeshellarg(\$runner) . ' ' . escapeshellarg(\$id) . ' ' . escapeshellarg(\$script) . \$flags . ' > /dev/null 2>&1 &');
}
" 2>/dev/null