diff --git a/bin/monitor.php b/bin/monitor.php index a298c4a..3a9fec4 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -2,7 +2,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); -$version="0.1r764"; +$version="0.1r765"; $db = new DB(); @@ -802,7 +802,10 @@ function writelog( $pane ) shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\" && $ds1 MYISAM_SMALL $ds2 && cd $_bin && $_php optimize_myisam.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 MYISAM_SMALL $ds3' 2>&1 1> /dev/null"); echo "\033[1;41;33mOPTIMIZATION OF THE MYSQL TABLES HAS STARTED, DO NOT STOP THIS SCRIPT!\033[1;0;33m\n\n"; $time11 = TIME(); - } elseif ( $array['OPTIMIZE'] != "true" ) { + } elseif (( $array['OPTIMIZE'] == "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\nOptimize Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $array['OPTIMIZE'] != "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\nOptimize Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } else { @@ -826,7 +829,10 @@ function writelog( $pane ) shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\" && $ds1 MYISAM_SMALL $ds2 && cd $_bin && $_php optimize_myisam.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 MYISAM_SMALL $ds3' 2>&1 1> /dev/null"); echo "\033[1;41;33mOPTIMIZATION OF THE MYSQL TABLES HAS STARTED, DO NOT STOP THIS SCRIPT!\033[1;0;33m\n\n"; $time11 = TIME(); - } elseif ( $array['OPTIMIZE'] != "true" ) { + } elseif (( $array['OPTIMIZE'] == "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\nOptimize Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $array['OPTIMIZE'] != "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\nOptimize Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } else { @@ -884,7 +890,10 @@ function writelog( $pane ) } elseif (( $total_work_used > $array['BINARIES_MAX_RELEASES'] ) && ( $array['BINARIES'] == "true" ) && ( $array['BINARIES_MAX_RELEASES'] != 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\nBINARIES_MAX_RELEASES exceeded\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $array['BINARIES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['BINARIES'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes0[2] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $array['BINARIES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes0[2] Disabled by BINARIES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif ( $optimize_safe_to_run == "true" ) { @@ -903,7 +912,10 @@ function writelog( $pane ) } elseif (( $total_work_used > $array['BACKFILL_MAX_RELEASES'] ) && ( $array['BACKFILL'] == "true" ) && ( $array['BACKFILL_MAX_RELEASES'] != 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\nBACKFILL_MAX_RELEASES exceeded\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $array['BACKFILL'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['BACKFILL'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[3] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $array['BACKFILL'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[3] Disabled by BACKFILL\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif ( $optimize_safe_to_run == "true" ) { @@ -926,20 +938,23 @@ function writelog( $pane ) } elseif (( $array['BINARIES'] != "true" ) && ( $array['BACKFILL'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes0[2] and $panes0[3] Disabled by BINARIES and BACKFILL\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $array['BACKFILL'] == "true" ) && ( $array['BINARIES'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['BACKFILL'] == "true" ) && ( $array['BINARIES'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time1 = relativeTime( $array['BACKFILL_SEQ_TIMER'] + $time14 ); $run_time2 = relativeTime( $array['BINARIES_SEQ_TIMER'] + $time13 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes0[2] will run in T[ $run_time2]\n$panes0[3] will run in T[ $run_time1] \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $array['BACKFILL'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['BACKFILL'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['BACKFILL_SEQ_TIMER'] + $time14 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes03] will run in T[ $run_time1]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $array['BINARIES'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['BINARIES'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['BINARIES_SEQ_TIMER'] + $time13 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes0[2] will run in T[ $run_time2]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes0[2] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes0[2] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -950,20 +965,23 @@ function writelog( $pane ) if (( $array['MAX_LOAD'] >= get_load()) && ( $array['BINARIES'] != "true" ) && ( $array['BACKFILL'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[2] and $panes0[3] Disabled by BINARIES and BACKFILL\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $array['BACKFILL'] == "true" ) && ( $array['BINARIES'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['BACKFILL'] == "true" ) && ( $array['BINARIES'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $run_time1 = relativeTime( $array['BACKFILL_SEQ_TIMER'] + $time14 ); $run_time2 = relativeTime( $array['BINARIES_SEQ_TIMER'] + $time13 ); $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[2] will run in T[ $run_time2]\n$panes0[3] will run in T[ $run_time1] \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $array['BACKFILL'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['BACKFILL'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $run_time = relativeTime( $array['BACKFILL_SEQ_TIMER'] + $time14 ); $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[3] will run in T[ $run_time1]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $array['BINARIES'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['BINARIES'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $run_time = relativeTime( $array['BINARIES_SEQ_TIMER'] + $time13 ); $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[2] will run in T[ $run_time2]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[3] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[3] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -976,11 +994,11 @@ function writelog( $pane ) shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\nBINARIES_MAX_ROWS and BACKFILL_MAX_ROWS exceeded\" && $ds1 $panes0[2] $ds4'"); shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\nBINARIES_MAX_ROWS and BACKFILL_MAX_ROWS exceeded\" && $ds1 $panes0[3] $ds4'"); } elseif ( $optimize_safe_to_run == "true" ) { - $color = get_color(); - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes0[2] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - $color = get_color(); - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[3] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\n$panes0[2] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\n$panes0[3] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } } //runs nzb-import in 0.4 once if needed and exits @@ -991,15 +1009,23 @@ function writelog( $pane ) $color = get_color(); $log = writelog($panes0[1]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.1 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes0[1] $ds2 && cd $_bin && $_php nzbcount.php 2>&1 $log' 2>&1 1> /dev/null"); + } elseif (( $parts_rows_unformatted > $array['IMPORT_MAX_ROWS'] ) && ( $array['IMPORT'] == "true" ) && ( $array['IMPORT_MAX_ROWS'] != 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.4 'echo \"\033[38;5;\"$color\"m\nIMPORT_MAX_ROWS exceeded\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $total_work_used > $array['IMPORT_MAX_RELEASES'] ) && ( $array['IMPORT'] == "true" ) && ( $array['IMPORT_MAX_RELEASES'] != 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.4 'echo \"\033[38;5;\"$color\"m\nIMPORT_MAX_RELEASES exceeded\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $array['IMPORT'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + + } elseif (( $array['IMPORT'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.4 'echo \"\033[38;5;\"$color\"m\n$panes0[4] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + + } elseif (( $array['IMPORT'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.4 'echo \"\033[38;5;\"$color\"m\n$panes0[4] Disabled by IMPORT\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.4 'echo \"\033[38;5;\"$color\"m\n$panes0[4] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); @@ -1013,7 +1039,10 @@ function writelog( $pane ) } elseif (( $array['IMPORT'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.1 'echo \"\033[38;5;\"$color\"m\n$panes0[1] Disabled by IMPORT\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.1 'echo \"\033[38;5;\"$color\"m\n$panes0[1] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.1 'echo \"\033[38;5;\"$color\"m\n$panes0[1] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1033,7 +1062,9 @@ function writelog( $pane ) shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\n$panes2[$h] $work_remaining_now < $f\nHas no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $g > $post ) && ( $optimize_safe_to_run != "true" )) { shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\n$panes2[$h] Disabled by POST_TO_RUN\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\n$panes2[$h] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\n$panes2[$h] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } } @@ -1043,7 +1074,7 @@ function writelog( $pane ) for ($g=17; $g<=32; $g++) { $h=$g-17; - $f=$h*100; + $f=($g-1)*100; $j=$g*2; $color = get_color(); $log = writelog($panes2[$h]); @@ -1053,7 +1084,9 @@ function writelog( $pane ) shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:3.$h 'echo \"\033[38;5;\"$color\"m\n$panes3[$h]\n$work_remaining_now < $f\nHas no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $g > $post ) && ( $optimize_safe_to_run != "true" )) { shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:3.$h 'echo \"\033[38;5;\"$color\"m\n$panes3[$h]\nDisabled by \nPOST_TO_RUN\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:3.$h 'echo \"\033[38;5;\"$color\"m\n$panes3[$h] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:3.$h 'echo \"\033[38;5;\"$color\"m\n$panes3[$h]\nDisabled by \nOPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } } @@ -1067,7 +1100,10 @@ function writelog( $pane ) $color = get_color(); $log = writelog($panes0[5]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.5 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes0[5] $ds2 && $mysql_command_2 2>&1 $log && cd $_bin && $_php update_releases.php 2>&1 $log && $mysql_command_2 2>&1 $log && echo \" \033[1;0;33m\" && echo \"sleeping\033[38;5;\"$color\"m {$array['RELEASES_SLEEP']} seconds...\" && sleep {$array['RELEASES_SLEEP']} && $ds1 $panes0[5] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['RELEASES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['RELEASES'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD_RELEASES'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.5 'echo \"\033[38;5;\"$color\"m\n$panes0[5] Disabled by MAX_LOAD_RELEASES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $array['RELEASES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.5 'echo \"\033[38;5;\"$color\"m\n$panes0[5] Disabled by RELEASES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif ( $optimize_safe_to_run == "true" ) { @@ -1081,13 +1117,16 @@ function writelog( $pane ) $log = writelog($panes1[0]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes1[0] $ds2 && cd $NNPATH && $_php update_predb.php true 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes1[0] $ds3' 2>&1 1> /dev/null"); $time2 = TIME(); - } elseif (( $array['PREDB'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['PREDB'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['PREDB_TIMER'] + $time2 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[38;5;\"$color\"m\n$panes1[0] will run in T[ $run_time]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $array['MAX_LOAD'] >= get_load()) && ( $array['PREDB'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[38;5;\"$color\"m\n$panes1[0] Disabled by PREDB\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[38;5;\"$color\"m\n$panes1[0] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[38;5;\"$color\"m\n$panes1[0] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); @@ -1119,14 +1158,17 @@ function writelog( $pane ) $log = writelog($panes1[1]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.1 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes1[1] $ds2 && cd $_bin && $_php update_parsing.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes1[1] $ds3' 2>&1 1> /dev/null"); $time3 = TIME(); - } elseif (( $optimize_safe_to_run != "true" ) && ( $array['PARSING'] != "true" ) && ( $array['FIX_DROID'] == "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['PARSING'] != "true" ) && ( $array['FIX_DROID'] == "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['PARSING_TIMER'] + $time3 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.1 'echo \"\033[38;5;\"$color\"m\nfix_android_releases will run in T[ $run_time]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $optimize_safe_to_run != "true" ) && (( $array['PARSING_MOD'] == "true" ) || ( $array['PARSING'] == "true" ))) { + } elseif (( $optimize_safe_to_run != "true" ) && (( $array['PARSING_MOD'] == "true" ) || ( $array['PARSING'] == "true" )) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['PARSING_TIMER'] + $time3 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.1 'echo \"\033[38;5;\"$color\"m\n$panes1[1] will run in T[ $run_time]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.1 'echo \"\033[38;5;\"$color\"m\n$panes1[1] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $array['PARSING'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.1 'echo \"\033[38;5;\"$color\"m\n$panes1[1] Disabled by PARSING\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); @@ -1144,11 +1186,14 @@ function writelog( $pane ) } elseif (( $array['CLEANUP'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.2 'echo \"\033[38;5;\"$color\"m\n$panes1[2] Disabled by CLEANUP\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run != "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['CLEANUP_TIMER'] + $time7 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.2 'echo \"\033[38;5;\"$color\"m\n$panes1[2] will run in T[ $run_time]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.2 'echo \"\033[38;5;\"$color\"m\n$panes1[2] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.2 'echo \"\033[38;5;\"$color\"m\n$panes1[2] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1159,14 +1204,17 @@ function writelog( $pane ) $log = writelog($panes1[3]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.3 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes1[3] $ds2 && cd $NNPATH && $_php update_tvschedule.php 2>&1 $log && $_php update_theaters.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes1[3] $ds3' 2>&1 1> /dev/null"); $time4 = TIME(); - } elseif (( $array['TV_SCHEDULE'] == "true") && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['TV_SCHEDULE'] == "true") && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['TVRAGE_TIMER'] + $time4 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.3 'echo \"\033[38;5;\"$color\"m\n$panes1[3] and update_theaters will run in T[ $run_time]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $array['TV_SCHEDULE'] != "true") && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.3 'echo \"\033[38;5;\"$color\"m\n$panes1[3] Disabled by TV_SCHEDULE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.3 'echo \"\033[38;5;\"$color\"m\n$panes1[3] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.3 'echo \"\033[38;5;\"$color\"m\n$panes1[3] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1180,11 +1228,14 @@ function writelog( $pane ) } elseif (( $array['SPHINX'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.5 'echo \"\033[38;5;\"$color\"m\n$panes1[5] Disabled by SPHINX\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run != "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['SPHINX_TIMER'] + $time9 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.5 'echo \"\033[38;5;\"$color\"m\n$panes1[5] will run in T[ $run_time]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.5 'echo \"\033[38;5;\"$color\"m\n$panes1[5] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.5 'echo \"\033[38;5;\"$color\"m\n$panes1[5] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1198,11 +1249,14 @@ function writelog( $pane ) } elseif (( $array['DELETE_PARTS'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.6 'echo \"\033[38;5;\"$color\"m\n$panes1[6] Disabled by DELETE_PARTS\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run != "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['DELETE_TIMER'] + $time16 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.6 'echo \"\033[38;5;\"$color\"m\n$panes1[6] will run in T[ $run_time]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.6 'echo \"\033[38;5;\"$color\"m\n$panes1[6] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.6 'echo \"\033[38;5;\"$color\"m\n$panes1[6] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1216,11 +1270,14 @@ function writelog( $pane ) } elseif (( $array['FETCH_MOVIE'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.7 'echo \"\033[38;5;\"$color\"m\n$panes1[7] Disabled by FETCH_MOVIE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run != "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['MOVIE_TIMER'] + $time17 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.7 'echo \"\033[38;5;\"$color\"m\n$panes1[7] will run in T[ $run_time]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.7 'echo \"\033[38;5;\"$color\"m\n$panes1[7] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.7 'echo \"\033[38;5;\"$color\"m\n$panes1[7] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1233,10 +1290,13 @@ function writelog( $pane ) } elseif (( $array['NFOS'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.0 'echo \"\033[38;5;\"$color\"m\n$panes4[0] Disabled by NFOS\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $nfo_remaining_now == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.0 'echo \"\033[38;5;\"$color\"m\n$panes4[0] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $nfo_remaining_now == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.0 'echo \"\033[38;5;\"$color\"m\n$panes4[0] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.0 'echo \"\033[38;5;\"$color\"m\n$panes4[0] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1249,10 +1309,13 @@ function writelog( $pane ) } elseif (( $array['NFOS'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.4 'echo \"\033[38;5;\"$color\"m\n$panes4[4] Disabled by NFOS\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $nfo_remaining_now == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.4 'echo \"\033[38;5;\"$color\"m\n$panes4[4] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $nfo_remaining_now == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.4 'echo \"\033[38;5;\"$color\"m\n$panes4[4] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.4 'echo \"\033[38;5;\"$color\"m\n$panes4[4] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1265,10 +1328,13 @@ function writelog( $pane ) } elseif (( $array['GAMES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.1 'echo \"\033[38;5;\"$color\"m\n$panes4[1] Disabled by GAMES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $console_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.1 'echo \"\033[38;5;\"$color\"m\n$panes4[1] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $console_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.1 'echo \"\033[38;5;\"$color\"m\n$panes4[1] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.1 'echo \"\033[38;5;\"$color\"m\n$panes4[1] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1281,10 +1347,13 @@ function writelog( $pane ) } elseif (( $array['GAMES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.5 'echo \"\033[38;5;\"$color\"m\n$panes4[5] Disabled by GAMES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $console_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.5 'echo \"\033[38;5;\"$color\"m\n$panes4[5] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $console_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.5 'echo \"\033[38;5;\"$color\"m\n$panes4[5] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.5 'echo \"\033[38;5;\"$color\"m\n$panes4[5] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1297,10 +1366,13 @@ function writelog( $pane ) } elseif (( $array['MOVIES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.2 'echo \"\033[38;5;\"$color\"m\n$panes4[2] Disabled by MOVIES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $movie_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.2 'echo \"\033[38;5;\"$color\"m\n$panes4[2] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $movie_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.2 'echo \"\033[38;5;\"$color\"m\n$panes4[2] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.2 'echo \"\033[38;5;\"$color\"m\n$panes4[2] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1313,10 +1385,13 @@ function writelog( $pane ) } elseif (( $array['MOVIES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.6 'echo \"\033[38;5;\"$color\"m\n$panes4[6] Disabled by MOVIES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $movie_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.6 'echo \"\033[38;5;\"$color\"m\n$panes4[6] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $movie_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.6 'echo \"\033[38;5;\"$color\"m\n$panes4[6] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.6 'echo \"\033[38;5;\"$color\"m\n$panes4[6] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1329,10 +1404,13 @@ function writelog( $pane ) } elseif (( $array['MUSIC'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.3 'echo \"\033[38;5;\"$color\"m\n$panes4[3] Disabled by MUSIC\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $music_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.3 'echo \"\033[38;5;\"$color\"m\n$panes4[3] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $music_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.3 'echo \"\033[38;5;\"$color\"m\n$panes4[3] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.3 'echo \"\033[38;5;\"$color\"m\n$panes4[3] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1345,10 +1423,13 @@ function writelog( $pane ) } elseif (( $array['MUSIC'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.7 'echo \"\033[38;5;\"$color\"m\n$panes4[7] Disabled by MUSIC\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $music_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.7 'echo \"\033[38;5;\"$color\"m\n$panes4[7] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $music_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.7 'echo \"\033[38;5;\"$color\"m\n$panes4[7] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.7 'echo \"\033[38;5;\"$color\"m\n$panes4[7] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1359,14 +1440,17 @@ function writelog( $pane ) $log = writelog($panes5[0]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.0 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes5[0] $ds2 && cd $_bin && $_php processSpotnab.php true 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes5[0] $ds3' 2>&1 1> /dev/null"); $time20 = TIME(); - } elseif (( $array['SPOTNAB'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['SPOTNAB'] == "true" ) && ( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] >= get_load())) { $color = get_color(); $run_time = relativeTime( $array['SPOTNAB_TIMER'] + $time20 ); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.0 'echo \"\033[38;5;\"$color\"m\n$panes5[0] will run in T[ $run_time]\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $array['SPOTNAB'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.0 'echo \"\033[38;5;\"$color\"m\n$panes5[0] Disabled by SPOTNAB\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.0 'echo \"\033[38;5;\"$color\"m\n$panes5[0] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.0 'echo \"\033[38;5;\"$color\"m\n$panes5[0] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1379,10 +1463,13 @@ function writelog( $pane ) } elseif (( $array['TVRAGE'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.4 'echo \"\033[38;5;\"$color\"m\n$panes5[4] Disabled by TVRAGE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run != "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.4 'echo \"\033[38;5;\"$color\"m\n$panes5[4] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run != "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.4 'echo \"\033[38;5;\"$color\"m\n$panes5[4] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.4 'echo \"\033[38;5;\"$color\"m\n$panes5[4] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1395,10 +1482,13 @@ function writelog( $pane ) } elseif (( $array['TVRAGE'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.1 'echo \"\033[38;5;\"$color\"m\n$panes5[1] Disabled by TVRAGE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $tvrage_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.1 'echo \"\033[38;5;\"$color\"m\n$panes5[1] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $tvrage_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.1 'echo \"\033[38;5;\"$color\"m\n$panes5[1] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.1 'echo \"\033[38;5;\"$color\"m\n$panes5[1] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1411,10 +1501,13 @@ function writelog( $pane ) } elseif (( $array['TVRAGE'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.5 'echo \"\033[38;5;\"$color\"m\n$panes5[5] Disabled by TVRAGE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $tvrage_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.5 'echo \"\033[38;5;\"$color\"m\n$panes5[5] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $tvrage_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.5 'echo \"\033[38;5;\"$color\"m\n$panes5[5] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.5 'echo \"\033[38;5;\"$color\"m\n$panes5[5] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1427,10 +1520,13 @@ function writelog( $pane ) } elseif (( $array['EBOOK'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.2 'echo \"\033[38;5;\"$color\"m\n$panes5[2] Disabled by EBOOK\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $book_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.2 'echo \"\033[38;5;\"$color\"m\n$panes5[2] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $book_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.2 'echo \"\033[38;5;\"$color\"m\n$panes5[2] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.2 'echo \"\033[38;5;\"$color\"m\n$panes5[2] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1443,10 +1539,13 @@ function writelog( $pane ) } elseif (( $array['EBOOK'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.6 'echo \"\033[38;5;\"$color\"m\n$panes5[6] Disabled by EBOOK\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif (( $book_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.6 'echo \"\033[38;5;\"$color\"m\n$panes5[6] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif (( $book_releases_proc == 0 ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.6 'echo \"\033[38;5;\"$color\"m\n$panes5[6] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.6 'echo \"\033[38;5;\"$color\"m\n$panes5[6] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1459,10 +1558,13 @@ function writelog( $pane ) } elseif (( $array['OTHERS'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.3 'echo \"\033[38;5;\"$color\"m\n$panes5[3] Disabled by OTHERS\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run != "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.3 'echo \"\033[38;5;\"$color\"m\n$panes5[3] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run != "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.3 'echo \"\033[38;5;\"$color\"m\n$panes5[3] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.3 'echo \"\033[38;5;\"$color\"m\n$panes5[3] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } @@ -1475,10 +1577,13 @@ function writelog( $pane ) } elseif (( $array['UNWANTED'] != "true" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.7 'echo \"\033[38;5;\"$color\"m\n$panes5[7] Disabled by UNWANTED\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run != "true" ) { + } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.7 'echo \"\033[38;5;\"$color\"m\n$panes5[7] Disabled by MAX_LOAD\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); + } elseif ( $optimize_safe_to_run != "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.7 'echo \"\033[38;5;\"$color\"m\n$panes5[7] Has no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); - } elseif ( $optimize_safe_to_run == "true" ) { + } elseif ( $optimize_safe_to_run == "true" ) { $color = get_color(); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.7 'echo \"\033[38;5;\"$color\"m\n$panes5[7] Disabled by OPTIMIZE\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } diff --git a/conf/jonnyboys_defaults.sh b/conf/jonnyboys_defaults.sh index 20932d8..3f5fc19 100644 --- a/conf/jonnyboys_defaults.sh +++ b/conf/jonnyboys_defaults.sh @@ -14,14 +14,14 @@ export RUNNING="true" #these scripts set the 'nice'ness of each script, default is 19, the lowest, the highest is -20 #anything between -1 and -20 require root/sudo to run -export NICENESS="10" +export NICENESS="1" #these scripts can add some serious load to your system, without proper monitoring it can be #to much, you can set the max load that any pane will be started at #for example, if you set load to 2, no pane will start when your system load exceeds 2 #this does not mean the the desired load will not be exceeded, just that no panes will be be restarted #this one is for all panes except update_releases -export MAX_LOAD="10.0" +export MAX_LOAD="6.0" #this one is for update_releases export MAX_LOAD_RELEASES="6.0" @@ -45,7 +45,7 @@ export ADMIN_PATH=$NEWZPATH"/www/admin" #trial and error for this, set to 1 will run > 0, set to 2 will run > 200, 3 will run > 300 and so on. #At some point, increasing this begins to slow things down. It will need to be adjusted for your system #to get the desired performance, 0 will disable all post processing -export POST_TO_RUN="10" +export POST_TO_RUN="16" ############################################################ @@ -101,7 +101,7 @@ export KEEP_KILLED="false" #this works by setting the 2 start timers and which is run at the start of the loop is determined like this #if at the start of the loop, the BINARIES_SEQ_TIMER has expired, then update_binaries will run and the BINARIES_SEQ_TIMER timer is reset #if BINARIES_SEQ_TIMER has not expired, then if BACKFILL_SEQ_TIMER has expired, the backfill will run and BACKFILL_SEQ_TIMER timer is reset -export SEQUENTIAL="true" +export SEQUENTIAL="truef" #time between loop start for update_binaries, in seconds, this is a countdown timer, not a sleep after it runs #default is 30 minutes @@ -198,7 +198,7 @@ export KEVIN_PARTS="100000" #Set the path to the nzb dump you downloaded from torrents, this is the path to bulk files folder of nzbs #this does not recurse through subfolders, unless you set NZB_THREADS to true -export NZBS="/nfs" +export NZBS="/home/jonnyboy/nzb_files" #Choose to run import nzb script true/false export IMPORT="true" @@ -214,7 +214,7 @@ export NZB_THREADS="true" export NZB_FOLDER_COUNT="50" #How many nzbs to import per loop, if using NZB_THREADS=true the per folder -export NZBCOUNT="20" +export NZBCOUNT="100" #Set, in seconds - how long the nzb-import should sleep between runs #below backfill @@ -467,7 +467,7 @@ export WWW_USER="jonnyboy:www-data" #if you have a ramdisk and would like to monitor it's use, set path here #this is not the same as RAMDISK above, I keep my parts table on a ramdisk -export RAMDISK_PATH="/var/ramdisk" +export RAMDISK_PATH="/" ###########################################################