diff --git a/bin/backfill_parts.php b/bin/backfill_parts.php index abac32d40..4b58c7a76 100644 --- a/bin/backfill_parts.php +++ b/bin/backfill_parts.php @@ -4,12 +4,10 @@ require_once(WWW_DIR."/lib/backfill.php"); require_once(WWW_DIR."/lib/framework/db.php"); $time = TIME(); -//get variables from config.sh and defaults.sh +//get variables from defaults.sh $path = dirname(__FILE__); -$varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); -$vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); +$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); +$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); diff --git a/bin/monitor.php b/bin/monitor.php index 6a3f23c7e..01f883114 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.1r777"; +$version="0.1r778"; $db = new DB(); @@ -19,12 +19,10 @@ $proc = "SELECT ( SELECT COUNT( groupID ) AS cnt from releases where consoleinfo //flush query cache $qcache = "FLUSH QUERY CACHE"; -//get variables from config.sh and defaults.sh +//get variables from defaults.sh $path = dirname(__FILE__); -$varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); -$vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); +$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); +$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); @@ -336,12 +334,10 @@ while( $i > 0 ) $ds3 = "stopped"; $ds4 = "killed"; - //refresh variables + //get variables from defaults.sh $path = dirname(__FILE__); - $varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); - $varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); - $vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); - $vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); + $varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); + $vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); @@ -1073,7 +1069,7 @@ while( $i > 0 ) } } - //start postprocessing in window 2 + //start postprocessing in window 3 $post = $array['POST_TO_RUN_B']; for ($g=1; $g<=16; $g++) { @@ -1288,11 +1284,11 @@ while( $i > 0 ) } //runs postprocess_nfo.php in pane 4.0 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $nfo_remaining_now > 0 ) && ( $array['NFOS'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $nfo_remaining_now > 0 ) && ( $array['NFOS'] != "0" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes4[0]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.0 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes4[0] $ds2 && cd $_bin && $_php postprocess_nfo.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes4[0] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['NFOS'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['NFOS'] == "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] Disabled by NFOS\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { @@ -1307,11 +1303,11 @@ while( $i > 0 ) } //runs postprocess_nfo1.php in pane 4.4 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $nfo_remaining_now >= 500 ) && ( $array['NFOS'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $nfo_remaining_now >= 500 ) && ( $array['NFOS'] == "2" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes4[4]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.4 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes4[4] $ds2 && cd $_bin && $_php postprocess_nfo1.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes4[4] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['NFOS'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['NFOS'] = "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] Disabled by NFOS\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { @@ -1326,11 +1322,11 @@ while( $i > 0 ) } //runs processGames.php in pane 4.1 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $console_releases_proc > 0 ) && ( $array['GAMES'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $console_releases_proc > 0 ) && ( $array['GAMES'] != "0" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes4[1]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.1 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes4[1] $ds2 && cd $_bin && $_php processGames.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes4[1] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['GAMES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['GAMES'] == "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] Disabled by GAMES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { @@ -1345,11 +1341,11 @@ while( $i > 0 ) } //runs processGames.php in pane 4.5 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $console_releases_proc >= 200 ) && ( $array['GAMES'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $console_releases_proc >= 200 ) && ( $array['GAMES'] == "2" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes4[5]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.5 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes4[5] $ds2 && cd $_bin && $_php processGames1.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes4[5] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['GAMES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['GAMES'] == "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] Disabled by GAMES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { @@ -1364,11 +1360,11 @@ while( $i > 0 ) } //runs processMovies.php in pane 4.2 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $movie_releases_proc > 0 ) && ( $array['MOVIES'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $movie_releases_proc > 0 ) && ( $array['MOVIES'] != "0" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes4[2]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.2 'echo \"\033[38;5;\"$color\"\" && $ds1 $panes4[2] $ds2 && cd $_bin && $_php processMovies.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes4[2] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['MOVIES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['MOVIES'] == "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] Disabled by MOVIES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { @@ -1383,11 +1379,11 @@ while( $i > 0 ) } //runs processMovies.php in pane 4.6 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $movie_releases_proc >= 200 ) && ( $array['MOVIES'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $movie_releases_proc >= 200 ) && ( $array['MOVIES'] == "2" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes4[6]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.6 'echo \"\033[38;5;\"$color\"\" && $ds1 $panes4[6] $ds2 && cd $_bin && $_php processMovies1.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes4[6] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['MOVIES'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['MOVIES'] == "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] Disabled by MOVIES\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { @@ -1402,11 +1398,11 @@ while( $i > 0 ) } //runs processMusic.php in pane 4.3 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $music_releases_proc > 0 ) && ( $array['MUSIC'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $music_releases_proc > 0 ) && ( $array['MUSIC'] != "0" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes4[3]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.3 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes4[3] $ds2 && cd $_bin && $_php processMusic.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes4[3] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['MUSIC'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['MUSIC'] == "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] Disabled by MUSIC\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { @@ -1421,11 +1417,11 @@ while( $i > 0 ) } //runs processMusic.php in pane 4.7 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $music_releases_proc >= 200 ) && ( $array['MUSIC'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $music_releases_proc >= 200 ) && ( $array['MUSIC'] == "2" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes4[7]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.7 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes4[7] $ds2 && cd $_bin && $_php processMusic1.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes4[7] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['MUSIC'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['MUSIC'] == "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] Disabled by MUSIC\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { @@ -1518,11 +1514,11 @@ while( $i > 0 ) } //runs processBooks.php in pane 5.2 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $book_releases_proc > 0 ) && ( $array['EBOOK'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $book_releases_proc > 0 ) && ( $array['EBOOK'] != "0" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes5[2]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.2 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes5[2] $ds2 && cd $_bin && $_php processBooks.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes5[2] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['EBOOK'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['EBOOK'] == "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] Disabled by EBOOK\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { @@ -1537,11 +1533,11 @@ while( $i > 0 ) } //runs processBooks.php in pane 5.6 once if needed then exits - if (( $array['MAX_LOAD'] >= get_load()) && ( $book_releases_proc >=200 ) && ( $array['EBOOK'] == "true" ) && ( $optimize_safe_to_run != "true" )) { + if (( $array['MAX_LOAD'] >= get_load()) && ( $book_releases_proc >=200 ) && ( $array['EBOOK'] == "2" ) && ( $optimize_safe_to_run != "true" )) { $color = get_color(); $log = writelog($panes5[6]); shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:5.6 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes5[6] $ds2 && cd $_bin && $_php processBooks1.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes5[6] $ds3' 2>&1 1> /dev/null"); - } elseif (( $array['EBOOK'] != "true" ) && ( $optimize_safe_to_run != "true" )) { + } elseif (( $array['EBOOK'] == "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] Disabled by EBOOK\" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $optimize_safe_to_run != "true" ) && ( $array['MAX_LOAD'] <= get_load())) { diff --git a/bin/nzb-import-sub.php b/bin/nzb-import-sub.php index 9b31d7234..b51b4221e 100644 --- a/bin/nzb-import-sub.php +++ b/bin/nzb-import-sub.php @@ -1,6 +1,6 @@ RegisterCallback('psUpdateComplete'); -$ps->maxThreads = $array['NZB_FOLDER_COUNT']; +$ps->maxThreads = 5; +$ps->tickCount = 50000; $ps->threadTimeLimit = 0; $selected = $subdir_count - 1; diff --git a/bin/nzb-import.php b/bin/nzb-import.php index 5920d35e7..f47ceca83 100644 --- a/bin/nzb-import.php +++ b/bin/nzb-import.php @@ -1,7 +1,7 @@ isPostBack() ) } - //get variables from config.sh and defaults.sh + //get variables from defaults.sh $path = dirname(__FILE__); - $varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); - $varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); - $vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); - $vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); + $varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); + $vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); diff --git a/bin/nzbcount.php b/bin/nzbcount.php index a87af0969..8cbc1859b 100644 --- a/bin/nzbcount.php +++ b/bin/nzbcount.php @@ -3,12 +3,10 @@ $subdir_count_now = 0; $filecount=0; -//get variables from config.sh and defaults.sh +//get variables from defaults.sh $path = dirname(__FILE__); -$varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); -$vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); +$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); +$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); @@ -37,12 +35,10 @@ while ($i==0) { $subdir_count_now=$subdir_count; } - //get variables from config.sh and defaults.sh + //get variables from defaults.sh $path = dirname(__FILE__); - $varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); - $varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); - $vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); - $vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); + $varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); + $vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); diff --git a/bin/processSpotnab.php b/bin/processSpotnab.php index a6ac21d77..135dae0bc 100644 --- a/bin/processSpotnab.php +++ b/bin/processSpotnab.php @@ -6,12 +6,10 @@ require(WWW_DIR.'/lib/postprocess.php'); $postprocess = new PostProcess(true); $postprocess->processSpotnab(); -//get variables from config.sh and defaults.sh +//get variables from defaults.sh $path = dirname(__FILE__); -$varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); -$vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); +$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); +$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); diff --git a/bin/safer_backfill_parts.php b/bin/safer_backfill_parts.php index 32321d258..49ce09573 100644 --- a/bin/safer_backfill_parts.php +++ b/bin/safer_backfill_parts.php @@ -7,12 +7,10 @@ require_once(WWW_DIR."/lib/backfill.php"); require_once(WWW_DIR."/lib/framework/db.php"); $time = TIME(); -//get variables from config.sh and defaults.sh +//get variables from defaults.sh $path = dirname(__FILE__); -$varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); -$vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); +$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); +$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); diff --git a/bin/scripts/check_vars.sh b/bin/scripts/check_vars.sh index 818364214..14514033a 100755 --- a/bin/scripts/check_vars.sh +++ b/bin/scripts/check_vars.sh @@ -11,26 +11,33 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" source defaults.sh -echo -e "\033[38;5;160m" -for vars in RUNNING USE_TWO_NNTP USE_TWO_PP NFOS GAMES MOVIES MUSIC TVRAGE EBOOK OTHERS UNWANTED KEEP_KILLED SEQUENTIAL BINARIES BINARIES_THREADS BACKFILL BACKFILL_THREADS KEVIN_SAFER KEVIN_BACKFILL_PARTS KEVIN_THREADED IMPORT NZB_THREADS IMPORT_TRUE MISC_ONLY RELEASES OPTIMIZE OPTIMIZE_KILL INNODB CLEANUP CLEANUP_EDIT PARSING PARSING_MOD FIX_DROID PAST_24_HOURS PREDB SPOTNAB SPOTNAB_ACTIVE TV_SCHEDULE SPHINX KILL_QUIET DELETE_PARTS FIX_POSIX USE_HTOP USE_BWMNG USE_MYTOP USE_ATOP USE_NMON USE_IOTOP USE_VNSTAT USE_TCPTRACK USE_TOP USE_IFTOP USE_CONSOLE POWERLINE EN_IMDB RAMDISK CHOWN_TRUE WRITE_LOGS +for vars in RUNNING USE_TWO_NNTP USE_TWO_PP TVRAGE OTHERS UNWANTED KEEP_KILLED SEQUENTIAL BINARIES BINARIES_THREADS BACKFILL BACKFILL_THREADS KEVIN_SAFER KEVIN_BACKFILL_PARTS KEVIN_THREADED IMPORT NZB_THREADS IMPORT_TRUE MISC_ONLY RELEASES OPTIMIZE OPTIMIZE_KILL INNODB CLEANUP CLEANUP_EDIT PARSING PARSING_MOD FIX_DROID PAST_24_HOURS PREDB SPOTNAB SPOTNAB_ACTIVE TV_SCHEDULE SPHINX KILL_QUIET DELETE_PARTS FIX_POSIX USE_HTOP USE_BWMNG USE_MYTOP USE_ATOP USE_NMON USE_IOTOP USE_VNSTAT USE_TCPTRACK USE_TOP USE_IFTOP USE_CONSOLE POWERLINE EN_IMDB RAMDISK CHOWN_TRUE WRITE_LOGS do #echo $vars=\"${!vars}\" - if [[ ${!vars} != "true" ]] && [[ ${!vars} != "false" ]]; then + if [[ ${!vars} != "true" && ${!vars} != "false" ]]; then clear - echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + echo -e "\033[38;5;160m $vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting\033[0m.\n"; exit 1 + fi +done + +for vars in NFOS GAMES MOVIES MUSIC EBOOK +do + if [[ ${!vars} != 0 && ${!vars} != 1 && ${!vars} != 2 ]]; then + clear + echo -e "\033[38;5;160m$vars=\"${!vars}\" is note valid number. Please edit defaults.sh and correct it. Aborting\033[0m.\n"; exit 1 fi done if ! [[ $NICENESS -le 19 && $NICENESS -ge -20 ]]; then clear - echo -e "NICENESS=$NICENESS is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + echo -e "\033[38;5;160mNICENESS=$NICENESS is not valid. Please edit defaults.sh and correct it. Aborting\033[0m.\n"; exit 1 fi -for vars in MAX_LOAD MAX_LOAD_RELEASES MONITOR_UPDATE KILL_UPDATES BINARIES_SEQ_TIMER BINARIES_SLEEP BINARIES_MAX_RELEASES BINARIES_MAX_BINS BINARIES_MAX_ROWS BACKFILL_SLEEP BACKFILL_MAX_RELEASES BACKFILL_MAX_BINS BACKFILL_MAX_ROWS MAXDAYS KEVIN_PARTS NZB_FOLDER_COUNT NZBCOUNT IMPORT_SLEEP IMPORT_MAX_RELEASES IMPORT_MAX_ROWS RELEASES_SLEEP MYISAM_SMALL MYISAM_LARGE INNODB_SMALL INNODB_LARGE CLEANUP_TIMER PARSING_TIMER PREDB_TIMER SPOTNAB_TIMER TVRAGE_TIMER SPHINX_TIMER KILL_PROCESS DELETE_TIMER +for vars in MAX_LOAD MAX_LOAD_RELEASES MONITOR_UPDATE KILL_UPDATES BINARIES_SEQ_TIMER BINARIES_SLEEP BINARIES_MAX_RELEASES BINARIES_MAX_BINS BINARIES_MAX_ROWS BACKFILL_SLEEP BACKFILL_MAX_RELEASES BACKFILL_MAX_BINS BACKFILL_MAX_ROWS MAXDAYS KEVIN_PARTS NZBCOUNT IMPORT_SLEEP IMPORT_MAX_RELEASES IMPORT_MAX_ROWS RELEASES_SLEEP MYISAM_SMALL MYISAM_LARGE INNODB_SMALL INNODB_LARGE CLEANUP_TIMER PARSING_TIMER PREDB_TIMER SPOTNAB_TIMER TVRAGE_TIMER SPHINX_TIMER KILL_PROCESS DELETE_TIMER do if ! [[ ${!vars} =~ ^[0-9]+([.][0-9]+)?$ ]]; then clear - echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + echo -e "\033[38;5;160m$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting\033[0m.\n"; exit 1 fi done @@ -38,7 +45,7 @@ for vars in POST_TO_RUN_A POST_TO_RUN_B do if ! [[ ${!vars} -le 16 && ${!vars} -ge 0 ]]; then clear - echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + echo -e "\033[38;5;160m$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting\033[0m.\n"; exit 1 fi done @@ -46,7 +53,7 @@ for vars in NEWZPATH NEWZNAB_PATH TESTING_PATH ADMIN_PATH NZBS RAMDISK_PATH do if [ ! -d ${!vars} ]; then clear - echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + echo -e "\033[38;5;160m$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting\033[0m.\n"; exit 1 fi done @@ -54,7 +61,7 @@ for vars in KEVIN_DATE do if ! [[ ${!vars} =~ ^2[0-1][0-9][0-9]-[0-1][0-9]-[0-3][0-9] ]]; then clear - echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + echo -e "\033[38;5;160m$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting\033[0m.\n"; exit 1 fi done @@ -62,7 +69,7 @@ for vars in SED USER_DEF_ONE USER_DEF_TWO USER_DEF_THREE USER_DEF_FOUR USER_DEF_ do if [ ! -f ${!vars} ]; then clear - echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + echo -e "\033[38;5;160m$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting\033[0m.\n"; exit 1 fi done @@ -72,8 +79,6 @@ if [[ $NEWZDASH_URL ]]; then wait $! script_exit_value=$? if [ "${script_exit_value}" -ne "0" ] ; then - echo -e "NEWZDASH_URL=\"$NEWZDASH_URL\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + echo -e "\033[38;5;160mNEWZDASH_URL=\"$NEWZDASH_URL\" is not valid. Please edit defaults.sh and correct it. Aborting\033[0m.\n"; exit 1 fi fi - -echo -e "\033[0m" diff --git a/bin/scripts/preflight.sh b/bin/scripts/preflight.sh index f39998fb0..19be52b19 100755 --- a/bin/scripts/preflight.sh +++ b/bin/scripts/preflight.sh @@ -9,13 +9,6 @@ do done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -if [ ! -f defaults.sh ]; then - clear - echo "Please copy config.sh to defaults.sh" - exit 1 -fi - -source config.sh source defaults.sh eval $( $SED -n "/^define/ { s/.*('\([^']*\)', '*\([^']*\)'*);/export \1=\"\2\"/; p }" "$NEWZPATH"/www/config.php ) diff --git a/bin/update_parsing.php b/bin/update_parsing.php index cb4317cdc..9de43dac4 100644 --- a/bin/update_parsing.php +++ b/bin/update_parsing.php @@ -10,12 +10,10 @@ require_once(WWW_DIR."/lib/categorymod.php"); require_once(WWW_DIR."/lib/movie.php"); -//get variables from config.sh and defaults.sh +//get variables from defaults.sh $path = dirname(__FILE__); -$varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); -$vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); -$vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); +$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); +$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'"); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); diff --git a/conf/jonnyboys_defaults.sh b/conf/jonnyboys_defaults.sh index 44442d90f..91e06edfc 100644 --- a/conf/jonnyboys_defaults.sh +++ b/conf/jonnyboys_defaults.sh @@ -46,10 +46,10 @@ export ADMIN_PATH=$NEWZPATH"/www/admin" #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, but not category processing #the first window has up to 16 postprocess and can use primary or alternate NNTP provider -export POST_TO_RUN_A="16" +export POST_TO_RUN_A="0" #The second window also has 16 processes and can use promary or alternate NNTP provider -export POST_TO_RUN_B="16" +export POST_TO_RUN_B="0" #by modifying www/config.php like http://pastebin.com/VgH9DCZw, you can use 1 provider to run update_binaries #and backup and another provider to run post processing with. Or, 1 provider to run up to 16 postprocesses and another to run @@ -70,22 +70,23 @@ export USE_TWO_PP="true" #post processing per category, setting the above to 0 does not disable these #run processNfos -export NFOS="true" +export NFOS="2" #run processGames -export GAMES="false" +export GAMES="0" #run processMovies -export MOVIES="false" +export MOVIES="0" #run processMusic -export MUSIC="false" - -#run processTV -export TVRAGE="false" +export MUSIC="0" #run processEbook -export EBOOK="false" +export EBOOK="0" + +#these are true/false +#run processTV +export TVRAGE="false" #run processOther export OTHERS="false" @@ -220,7 +221,7 @@ export KEVIN_PARTS="100000" export NZBS="/home/jonnyboy/nzb_files2/nzbs" #Choose to run import nzb script true/false -export IMPORT="false" +export IMPORT="true" #If, you have all of your nzbs in one folder select false #If, you have all of you nzbs split into separate in with the root at $NZBS then select true @@ -229,9 +230,6 @@ export IMPORT="false" #Instead of doing all 1 type at once, spread the load export NZB_THREADS="true" -#Set max number of folders to process per loop. This includes empty folders. -export NZB_FOLDER_COUNT="50" - #How many nzbs to import per loop, if using NZB_THREADS=true the per folder export NZBCOUNT="2" @@ -495,7 +493,7 @@ export RAMDISK_PATH="/" ########################################################### #logs can be written, per pane, to the logs folder -export WRITE_LOGS="true" +export WRITE_LOGS="false" ########################################################### diff --git a/config.sh b/config.sh index cfe4bf580..5c5f213ed 100644 --- a/config.sh +++ b/config.sh @@ -69,23 +69,25 @@ export USE_TWO_PP="false" ############################################################ #post processing per category, setting the above to 0 does not disable these +#this now takes 0 for noe, 1 for the first processor or 2 for both processors #run processNfos -export NFOS="false" +export NFOS="0" #run processGames -export GAMES="false" +export GAMES="0" #run processMovies -export MOVIES="false" +export MOVIES="0" #run processMusic -export MUSIC="false" - -#run processTV -export TVRAGE="false" +export MUSIC="0" #run processEbook -export EBOOK="false" +export EBOOK="0" + +#these are true/false +#run processTV +export TVRAGE="false" #run processOther export OTHERS="false" @@ -217,21 +219,19 @@ 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 +#this must be a valid path export NZBS="/path/to/nzbs" #Choose to run import nzb script true/false export IMPORT="false" #If, you have all of your nzbs in one folder select false -#If, you have all of you nzbs split into separate in with the root at $NZBS then select true +#If, you have all of you nzbs split into separate folders, with the root at $NZBS then select true #and 10 nzbs will be imported from each subfolder per loop. #Importing this way, allows all post processing scripts to run, such as book, music, movies -#Instead of doing all 1 type at once, spread the load +#Instead of doing all 1 type at once, spreads the work load export NZB_THREADS="false" -#Set max number of folders to process per loop. This includes empty folders. -export NZB_FOLDER_COUNT="20" - #How many nzbs to import per loop, if using NZB_THREADS=true the per folder export NZBCOUNT="10" diff --git a/scripts/reset_truncate.php b/scripts/reset_truncate.php index 779faf726..9e8e66852 100644 --- a/scripts/reset_truncate.php +++ b/scripts/reset_truncate.php @@ -4,10 +4,16 @@ require_once(WWW_DIR."/lib/framework/db.php"); $db = new DB; + $rel = $db->query("update groups set backfill_target=0, first_record=0, first_record_postdate=null, last_record=0, last_record_postdate=null, last_updated=null"); -$rel = $db->query("truncate table parts"); -$rel = $db->query("truncate table partsrepair"); -$rel = $db->query("truncate table binaries;"); +printf("Reseting all groups completed.\n"); + +$arr = array("parts", "partrepair", "binaries"); +foreach ($arr as &$value) { + $rel = $db->query("truncate table $value"); + printf("Truncating $value completed.\n"); +} +unset($value); //get variables from config.sh and defaults.sh $path = dirname(__FILE__); diff --git a/scripts/truncate_tables.php b/scripts/truncate_tables.php index a6b4e4df8..4cf33fa3e 100755 --- a/scripts/truncate_tables.php +++ b/scripts/truncate_tables.php @@ -4,8 +4,13 @@ require_once(WWW_DIR."/lib/framework/db.php"); $db = new DB; -$rel = $db->query("truncate table parts"); -$rel = $db->query("truncate table partsrepair"); -$rel = $db->query("truncate table binaries;"); +$arr = array("parts", "partrepair", "binaries"); + +foreach ($arr as &$value) { + $rel = $db->query("truncate table $value"); + printf("Truncating $value completed.\n"); +} +unset($value); + ?> diff --git a/start.sh b/start.sh index c1af62e0f..267f868c1 100755 --- a/start.sh +++ b/start.sh @@ -15,7 +15,6 @@ if [ ! -f defaults.sh ]; then exit fi -source config.sh source defaults.sh eval $( $SED -n "/^define/ { s/.*('\([^']*\)', '*\([^']*\)'*);/export \1=\"\2\"/; p }" "$NEWZPATH"/www/config.php )