Пример #1
0
$pdo = new Settings();
$DIR = NN_TMUX;
$c = new ColorCLI();
$t = new Tmux();
$tmux = $t->get();
$import = isset($tmux->import) ? $tmux->import : 0;
$tmux_session = isset($tmux->tmux_session) ? $tmux->tmux_session : 0;
$seq = isset($tmux->sequential) ? $tmux->sequential : 0;
$powerline = isset($tmux->powerline) ? $tmux->powerline : 0;
$colors = isset($tmux->colors) ? $tmux->colors : 0;
$nntpproxy = $pdo->getSetting('nntpproxy');
$tablepergroup = $pdo->getSetting('tablepergroup');
$tablepergroup = $tablepergroup != '' ? $tablepergroup : 0;
// Check that Db patch level is current. Also checks nZEDb.xml is valid.
Utility::isPatched();
Utility::clearScreen();
echo "Starting Tmux...\n";
// Create a placeholder session so tmux commands do not throw server not found errors.
exec('tmux new-session -ds placeholder 2>/dev/null');
// Search for NNTPProxy session that might be running from a user threaded.php run. Setup a clean environment to run in.
exec("tmux list-session | grep NNTPProxy", $nntpkill);
if (count($nntpkill) !== 0) {
    exec("tmux kill-session -t NNTPProxy");
    echo $pdo->log->notice("Found NNTPProxy tmux session and killing it.");
} else {
    exec("tmux list-session", $session);
}
//check if session exists
$session = shell_exec("tmux list-session | grep {$tmux_session}");
// Kill the placeholder
exec('tmux kill-session -t placeholder');