Nchan start/stop foundation

This commit is contained in:
bergware
2021-05-12 19:54:01 +02:00
parent cd96527280
commit 7a793aa93c
@@ -1081,13 +1081,18 @@ foreach ($pages as $page) {
if (count($pages)) {
$running = file_exists($nchan_no) ? explode(',',file_get_contents($nchan_no)) : [];
$start = array_diff($nchan, $running); // returns any new scripts to be started
// update list of current running nchan scripts
$running = array_merge($start,$running);
// start nchan scripts per page
foreach ($start as $script) exec("$nchan_go/$script &>/dev/null &");
/*
For the time being we don't stop the scripts, which allows multiple active browser sessions to work
$stop = array_diff($running, $nchan); // returns any old scripts to be stopped
// stop running nchan scripts
foreach ($stop as $script) exec("pkill $script >/dev/null &");
// start nchan scripts per page
foreach ($start as $script) exec("$nchan_go/$script &>/dev/null &");
// update list of current running nchan scripts
$running = array_merge(array_diff($stop,$running),$nchan);
*/
if (count($running)) file_put_contents($nchan_no,implode(',',$running)); else @unlink($nchan_no);
}
unset($pages,$page,$pgs,$pg,$icon,$nchan,$running,$start,$stop);