diff --git a/misc/update_scripts/nix_scripts/tmux/monitor.php b/misc/update_scripts/nix_scripts/tmux/monitor.php index 60d698fef..0d509e311 100644 --- a/misc/update_scripts/nix_scripts/tmux/monitor.php +++ b/misc/update_scripts/nix_scripts/tmux/monitor.php @@ -353,10 +353,18 @@ while ($runVar['counts']['iterations'] > 0) { $tRun->runPane('notrunning', $runVar); } - $runVar['counts']['iterations']++; - sleep(10); + $exit = $pdo->getSetting('tmux.run.exit'); + if ($exit == 0) { + $runVar['counts']['iterations']++; + sleep(10); + } else { + // Set counter to less than one so the loop will exit. + $runVar['counts']['iterations'] = ($exit < 0) ? $exit : 0; + } } +// TODO add code here to handle all panes shutting down before closing. + function errorOnSQL($pdo) { echo $pdo->log->error(PHP_EOL . "Monitor encountered severe errors retrieving process data from MySQL. Please diagnose and try running again." . PHP_EOL); diff --git a/newznab/build/newznab.xml b/newznab/build/newznab.xml index e89a4250f..df6514680 100644 --- a/newznab/build/newznab.xml +++ b/newznab/build/newznab.xml @@ -2,8 +2,8 @@ - 125 - 125 + 126 + 126 0.4.1 diff --git a/resources/db/patches/0126~settings.sql b/resources/db/patches/0126~settings.sql new file mode 100644 index 000000000..9176db073 --- /dev/null +++ b/resources/db/patches/0126~settings.sql @@ -0,0 +1,9 @@ +INSERT INTO settings (section, subsection, name, value, hint, setting) + VALUES ( + 'tmux', + 'running', + 'exit', + 0, + 'Determines if the running tmux monitor script should exit. If 0 nothing changes; if positive the script should exit gracefully (allowing all panes to finish); if negative the script should die as soon as possible.', + 'tmux.running.exit' + ); \ No newline at end of file