diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..41e56e5ec --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +fix.sh diff --git a/bin/monitor.php b/bin/monitor.php index 300db86e8..dca432c98 100755 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -71,6 +71,8 @@ $_threads = getenv('THREADS'); $_innodb = getenv('INNODB'); $_string = "\033[1;34mPane is dead?\033[1;33m This means that the script has finished and the pane is idle until the next time the script is called.\033[0m"; +$_string1 = "\033[1;33mThis means that the script has no work to do and the pane is idle until the next time the script is called.\033[0m"; +$_string2 = "\033[1;33mYou have disabled this in edit_these.sh and therefore has no work to do and the pane is idle until the next time the script is called.\033[0m"; $_sleep_string = "\033[1;34msleeping\033[0m "; $time = TIME(); @@ -200,30 +202,48 @@ while($i>0) // } if ( $work_remaining_now > 0 ) { shell_exec("tmux respawnp -t Newznab-dev:0.2 'cd bin && $_php processAlternate2.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.2 'echo \"$_string1\"' 2>&1 1> /dev/null"); } if ( $work_remaining_now > 200 ) { shell_exec("tmux respawnp -t Newznab-dev:0.3 'cd bin && $_php processAlternate3.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.3 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 200. $_string1\"' 2>&1 1> /dev/null"); } if ( $work_remaining_now > 400 ) { shell_exec("tmux respawnp -t Newznab-dev:0.4 'cd bin && $_php processAlternate4.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.4 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 400. $_string1\"' 2>&1 1> /dev/null"); } if ( $work_remaining_now > 600 ) { shell_exec("tmux respawnp -t Newznab-dev:0.5 'cd bin && $_php processAlternate5.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.5 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 600. $_string1\"' 2>&1 1> /dev/null"); } if ( $book_releases_proc > 0 ) { shell_exec("tmux respawnp -t Newznab-dev:0.6 'cd bin && $_php processBooks.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.6 'echo \"\033[1;34m\n$book_releases_proc\033[1;33m books to process. $_string1\"' 2>&1 1> /dev/null"); } if ( $console_releases_proc > 0 ) { shell_exec("tmux respawnp -t Newznab-dev:0.7 'cd bin && $_php processGames.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.7 'echo \"\033[1;34m\n$console_releases_proc\033[1;33m console to process. $_string1\"' 2>&1 1> /dev/null"); } if ( $movie_releases_proc > 0 ) { shell_exec("tmux respawnp -t Newznab-dev:0.8 'cd bin && $_php processMovies.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.8 'echo \"\033[1;34m\n$movie_releases_proc\033[1;33m movies to process. $_string1\"' 2>&1 1> /dev/null"); } if ( $music_releases_proc > 0 ) { shell_exec("tmux respawnp -t Newznab-dev:0.9 'cd bin && $_php processMusic.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.9 'echo \"\033[1;34m\n$music_releases_proc\033[1;33m music to process. $_string1\"' 2>&1 1> /dev/null"); } if ( $tvrage_releases_proc > 0 ) { shell_exec("tmux respawnp -t Newznab-dev:0.10 'cd bin && $_php processTv.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.10 'echo \"\033[1;34m\n$tvrage_releases_proc\033[1;33m tv shows to process. $_string1\"' 2>&1 1> /dev/null"); } shell_exec("tmux respawnp -t Newznab-dev:0.11 'cd bin && $_php processOthers.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); @@ -244,14 +264,20 @@ while($i>0) if (( $total_work_now < $_max_releases ) || ( $_max_releases == 0 ) && ( $_binaries == "true" )) { shell_exec("tmux respawnp -t Newznab-dev:0.12 'cd $_update_path && $_php $_update_cmd && date && echo \"$_sleep_string $_nntp seconds...\" && sleep $_nntp && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.12 'echo \"$_string2\"' 2>&1 1> /dev/null"); } if (( $total_work_now < $_max_releases ) || ( $_max_releases == 0 ) && ( $_backfill == "true" )) { shell_exec("tmux respawnp -t Newznab-dev:0.13 'cd $_update_path && $_php $_backfill_cmd && \ $_mysql -u$_DB_USER -h $_DB_HOST --password=$_DB_PASSWORD $_DB_NAME -e \"${backfill_increment}\" && \ date && echo \"$_sleep_string $_nntp seconds...\" && sleep $_nntp && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.13 'echo \"$_string2\"' 2>&1 1> /dev/null"); } if (( $total_work_now < $_max_releases ) || ( $_max_releases == 0 ) && ( $_import == "true" )) { shell_exec("tmux respawnp -t Newznab-dev:0.14 'cd $_import_path && $_php $_import_cmd \"$_nzbs\" true && date && echo \"$_sleep_string $_rel_sleep seconds...\" && sleep $_rel_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t Newznab-dev:0.14 'echo \"$_string2\"' 2>&1 1> /dev/null"); } shell_exec("tmux respawnp -t Newznab-dev:0.15 'cd $_newznab_path && $_php update_releases.php && date && echo \"$_sleep_string $_rel_sleep seconds...\" && sleep $_rel_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); diff --git a/edit_these.sh b/edit_these.sh index dbaeda7c6..ac4ef83a7 100755 --- a/edit_these.sh +++ b/edit_these.sh @@ -62,7 +62,7 @@ export IMPORT="true" #Choose to run optimise_db script true/false #set to false by default, you should test the optimse scripts in bin/innodb first -export OMPTIMISE="false" +export OPTIMISE="true" #Set the max amount of unprocessed releases and still allow nzb-import, backfill and update_releases to run #set to 0 to disable diff --git a/fix.sh b/fix.sh new file mode 100755 index 000000000..627e39b76 --- /dev/null +++ b/fix.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +if grep -q '/path/to/nzbs' "edit_these.sh" ; then + sed -i -e 's/export NZBS=.*$/\export NZBS="\/home\/jonnyboy\/nzbs\/batch"/' edit_these.sh + sed -i -e 's/export OMPTIMISE=.*$/export OMPTIMISE="true"/' edit_these.sh + sed -i -e 's/export AGREED=.*$/export AGREED="yes"/' edit_these.sh +else + sed -i -e 's/export NZBS=.*$/export NZBS="\/path\/to\/nzbs"/' edit_these.sh + sed -i -e 's/export OMPTIMISE=.*$/export OMPTIMISE="false"/' edit_these.sh + sed -i -e 's/export AGREED=.*$/export AGREED="no"/' edit_these.sh +fi +