From 48aa4e0963a8ec21df16a949a3a51cc65bf7699b Mon Sep 17 00:00:00 2001 From: jonnyboy Date: Wed, 23 Jan 2013 20:36:35 +0100 Subject: [PATCH] changed postprocess to variable from 1-9 fixed path issue with optimise --- README.md | 2 - bin/.gitignore | 1 + bin/monitor.php | 165 ++++++++++++++++++++++++++++---------- bin/processAlternate2.php | 11 --- bin/processAlternate3.php | 9 --- bin/processAlternate4.php | 11 --- bin/processAlternate5.php | 11 --- edit_these.sh | 9 ++- start.sh | 65 +++++++-------- 9 files changed, 158 insertions(+), 126 deletions(-) create mode 100644 bin/.gitignore delete mode 100755 bin/processAlternate2.php delete mode 100755 bin/processAlternate3.php delete mode 100755 bin/processAlternate4.php delete mode 100755 bin/processAlternate5.php diff --git a/README.md b/README.md index e4ccd572c..699000fb4 100644 --- a/README.md +++ b/README.md @@ -85,5 +85,3 @@ * If, you find these scripts useful and would like to offer a donation, they are greatly appreciated. Thank you PayPal - The safer, easier way to pay online!Click here to lend your support to: Newznab-tmux and make a donation at www.pledgie.com ! - - diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 000000000..e23e5638a --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1 @@ +processAlternate* diff --git a/bin/monitor.php b/bin/monitor.php index 9ef38cbbb..de437d307 100755 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -71,7 +71,7 @@ $_nzbs = getenv('NZBS'); $_nzbs_to_import_begin = count(glob($_nzbs."/*.nzb")); $_newznab_path = getenv('NEWZNAB_PATH'); $_testing_path = getenv('TESTING_PATH'); -$_current_path = getenv('CURRENT_DIR'); +$_current_path = dirname(__FILE__); $_mysql = getenv('MYSQL'); $_php = getenv('PHP'); $_nntp = getenv('NNTP_SLEEP'); @@ -82,6 +82,7 @@ $_threads = getenv('THREADS'); $_innodb = getenv('INNODB'); $_tmux_session = getenv('TMUX_SESSION'); $_show_why = getenv('SHOW_WHY'); +$_post_to_run = getenv('POST_TO_RUN'); if ( $_show_why=="true" ) { $_string = "\033[1;31mPane 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"; @@ -102,6 +103,33 @@ $time5 = TIME(); $time6 = TIME(); $time7 = TIME(); +//create new window for addition postprocessing +if ( $_post_to_run > 1 ) { + shell_exec("tmux neww -n postprocessing 'echo \"...\"' && tmux swap-window -t 2"); +} +if ( $_post_to_run > 2 ) { + shell_exec("tmux select-pane -t $_tmux_session:2.0 && tmux splitw -h -p 50 'echo \"...\"'"); +} +if ( $_post_to_run > 3 ) { + shell_exec("tmux select-pane -t $_tmux_session:2.0 && tmux splitw -v -p 50 'echo \"...\"'"); +} +if ( $_post_to_run > 4 ) { + shell_exec("tmux select-pane -t $_tmux_session:2.2 && tmux splitw -v -p 50 'echo \"...\"'"); +} +if ( $_post_to_run > 5 ) { + shell_exec("tmux select-pane -t $_tmux_session:2.0 && tmux splitw -h -p 50 'echo \"...\"'"); +} +if ( $_post_to_run > 6 ) { + shell_exec("tmux select-pane -t $_tmux_session:2.2 && tmux splitw -h -p 50 'echo \"...\"'"); +} +if ( $_post_to_run > 7 ) { + shell_exec("tmux select-pane -t $_tmux_session:2.4 && tmux splitw -h -p 50 'echo \"...\"'"); +} +if ( $_post_to_run > 8 ) { + shell_exec("tmux select-pane -t $_tmux_session:2.6 && tmux splitw -h -p 50 'echo \"...\"'"); +} +shell_exec("tmux select-window -t $_tmux_session:0"); + $i=1; while($i>0) { @@ -209,28 +237,37 @@ while($i>0) $parts_rows = number_format("$parts_rows"); printf("\n \033[0mThe parts table has \033[1;31m$parts_rows\033[0m rows and is \033[1;31m$parts_size_gb\n"); + //run update_predb.php in 1.0 ever 15 minutes if ((TIME() - $time2) >= 900 ) { shell_exec("tmux respawnp -t $_tmux_session:1.0 'echo \"\033[1;31m\" && cd $_newznab_path && $_php update_predb.php true && date && echo \"$_string\"' 2>&1 1> /dev/null"); $time2 = TIME(); } + + //run $_php update_parsing.php in 1.1 every 1 hour if (((TIME() - $time3) >= 3600 ) && ($_parsing == "true" )) { shell_exec("tmux respawnp -t $_tmux_session:1.1 'echo \"\033[1;32m\" && cd $_testing_path && $_php update_parsing.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); $time3 = TIME(); } + + //run $_php removespecial.php and $_php update_cleanup.php in 1.2 ever 1 hour if (((TIME() - $time7) >= 3600 ) && ($_cleanup == "true" )) { shell_exec("tmux respawnp -t $_tmux_session:1.2 'echo \"\033[1;33m\" && cd $_testing_path && $_php removespecial.php && $_php update_cleanup.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); $time7 = TIME(); } + + //run update_tvschedule.php and $_php update_theaters.php in 1.3 every 12 hours and first loop if (((TIME() - $time4) >= 43200) || ($i == 1 )) { shell_exec("tmux respawnp -t $_tmux_session:1.3 'echo \"\033[1;34m\" && cd $_newznab_path && $_php update_tvschedule.php && $_php update_theaters.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); $time4 = TIME(); } + if (TIME() - $time5 >= 7200) { if (( $_innodb== "true" ) && ( $_optimise == "true" )) { shell_exec("tmux respawnp -t $_tmux_session:1.4 'echo \"\033[1;36m\" && cd bin && $_php optimise_innodb.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); $time5 = TIME(); } } + if (TIME() - $time6 >= 86400) { if (( $_innodb== "true" ) && ( $_optimise == "true" )) { shell_exec("tmux respawnp -k -t $_tmux_session:1.5 'echo \"\033[1;37m\" && cd bin && $_php optimise_myisam.php true && $_php optimise_innodb.php true && date && echo \"$_string\"' 2>&1 1> /dev/null"); @@ -240,57 +277,43 @@ while($i>0) //check if scripts need to be started if ( $nfo_remaining_now > 0 ) { - shell_exec("tmux respawnp -t $_tmux_session:0.1 'echo \"\033[0;31m\" && cd bin && $_php postprocess_nfo.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.1 'echo \"\033[0;32m\" && cd bin && $_php postprocess_nfo.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); } else { - shell_exec("tmux respawnp -t $_tmux_session:0.6 'echo \"\033[1;31m\n$nfo_remaining_now\033[1;33m nfos to process. $_string1\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.1 'echo \"\033[1;32m\n$nfo_remaining_now\033[1;33m nfos to process. $_string1\"' 2>&1 1> /dev/null"); } + if ( $work_remaining_now > 0 ) { - shell_exec("tmux respawnp -t $_tmux_session:0.2 'echo \"\033[0;32m\" && cd bin && $_php processAlternate2.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.2 'echo \"\033[0;33m\" && cd bin && $_php processAlternate1.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); } else { shell_exec("tmux respawnp -t $_tmux_session:0.2 'echo \"$_string1\"' 2>&1 1> /dev/null"); } - if ( $work_remaining_now > 200 ) { - shell_exec("tmux respawnp -t $_tmux_session:0.3 'echo \"\033[0;33m\" && cd bin && $_php processAlternate3.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); - } else { - shell_exec("tmux respawnp -t $_tmux_session: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 $_tmux_session:0.4 'echo \"\033[0;36m\" && cd bin && $_php processAlternate4.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); - } else { - shell_exec("tmux respawnp -t $_tmux_session:0.4 'echo \"\033[0;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 $_tmux_session:0.5 'echo \"\033[0;35m\" && cd bin && $_php processAlternate5.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); - } else { - shell_exec("tmux respawnp -t $_tmux_session: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 $_tmux_session:0.6 'echo \"\033[0;36m\" && cd bin && $_php processBooks.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.3 'echo \"\033[0;34m\" && cd bin && $_php processBooks.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); } else { - shell_exec("tmux respawnp -t $_tmux_session:0.6 'echo \"\033[1;31m\n$book_releases_proc\033[1;33m books to process. $_string1\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.3 '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 $_tmux_session:0.7 'echo \"\033[1;37m\" && cd bin && $_php processGames.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.4 'echo \"\033[1;35m\" && cd bin && $_php processGames.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); } else { - shell_exec("tmux respawnp -t $_tmux_session:0.7 'echo \"\033[1;31m\n$console_releases_proc\033[1;33m console to process. $_string1\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.4 'echo \"\033[1;36m\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 $_tmux_session:0.8 'echo \"\033[1;31m\" && cd bin && $_php processMovies.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.5 'echo \"\033[1;37m\" && cd bin && $_php processMovies.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); } else { - shell_exec("tmux respawnp -t $_tmux_session:0.8 'echo \"\033[1;31m\n$movie_releases_proc\033[1;33m movies to process. $_string1\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.5 'echo \"\033[1;37m\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 $_tmux_session:0.9 'echo \"\033[1;32m\" && cd bin && $_php processMusic.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.6 'echo \"\033[1;31m\" && cd bin && $_php processMusic.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); } else { - shell_exec("tmux respawnp -t $_tmux_session:0.9 'echo \"\033[1;31m\n$music_releases_proc\033[1;33m music to process. $_string1\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.6 'echo \"\033[1;31m\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 $_tmux_session:0.10 'echo \"\033[1;33m\" && cd bin && $_php processTv.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.7 'echo \"\033[1;32m\" && cd bin && $_php processTv.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); } else { - shell_exec("tmux respawnp -t $_tmux_session:0.10 'echo \"\033[1;31m\n$tvrage_releases_proc\033[1;33m tv shows to process. $_string1\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.7 'echo \"\033[1;32m\n$tvrage_releases_proc\033[1;33m tv shows to process. $_string1\"' 2>&1 1> /dev/null"); } - shell_exec("tmux respawnp -t $_tmux_session:0.11 'echo \"\033[1;34m\" && cd bin && $_php processOthers.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); - + shell_exec("tmux respawnp -t $_tmux_session:0.8 'echo \"\033[1;33m\" && cd bin && $_php processOthers.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); if ( $_threads == "true" ) { $_update_path = $_newznab_path; @@ -304,35 +327,93 @@ while($i>0) if ( $_binaries == "true" ) { if (( $total_work_now < $_max_releases ) || ( $_max_releases == 0 )) { - shell_exec("tmux respawnp -t $_tmux_session:0.12 'echo \"\033[1;34m\" && cd $_update_path && $_php $_update_cmd && date && echo \"$_sleep_string $_nntp seconds...\" && sleep $_nntp && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.9 'echo \"\033[1;34m\" && 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 $_tmux_session:0.12 'echo \"$_string2\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.9 'echo \"$_string2\"' 2>&1 1> /dev/null"); } } + if ( $_backfill == "true" ) { if (( $total_work_now < $_backfill_max_releases ) || ( $_backfill_max_releases == 0 )) { - shell_exec("tmux respawnp -t $_tmux_session:0.13 'echo \"\033[1;35m\" && 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 $_backfill_sleep seconds...\" && sleep $_backfill_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.10 'echo \"\033[1;35m\" && 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 $_backfill_sleep seconds...\" && sleep $_backfill_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); } else { - shell_exec("tmux respawnp -t $_tmux_session:0.13 'echo \"$_string2\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.10 'echo \"$_string2\"' 2>&1 1> /dev/null"); } } + if ( $_import == "true" ) { if (( $total_work_now < $_import_max_releases ) || ( $_import_max_releases == 0 )) { - shell_exec("tmux respawnp -t $_tmux_session:0.14 'echo \"\033[1;36m\" && cd bin && $_php nzb-import.php \"$_nzbs\" true && date && echo \"$_sleep_string $_import_sleep seconds...\" && sleep $_import_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.11 'echo \"\033[1;36m\" && cd bin && $_php nzb-import.php \"$_nzbs\" true && echo \" \" && date && echo \"$_sleep_string $_import_sleep seconds...\" && sleep $_import_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); } else { - shell_exec("tmux respawnp -t $_tmux_session:0.14 'echo \"$_string2\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.11 'echo \"\n$_string2\"' 2>&1 1> /dev/null"); } } if ( $_optimise == "true" ) { - shell_exec("tmux respawnp -t $_tmux_session:0.15 'echo \"\033[1;37m\" && cd $_newznab_path && $_php update_releases.php && cd $_current_path/bin && $_php optimize_myisam.php && date && echo \"$_sleep_string $_rel_sleep seconds...\" && sleep $_rel_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.12 'echo \"\033[1;37m\" && cd $_newznab_path && $_php update_releases.php && cd $_current_path && $_php optimize_myisam.php && date && echo \"$_sleep_string $_rel_sleep seconds...\" && sleep $_rel_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); } else { - shell_exec("tmux respawnp -t $_tmux_session:0.15 'echo \"\033[1;37m\" && cd $_newznab_path && $_php update_releases.php && date && echo \"$_sleep_string $_rel_sleep seconds...\" && sleep $_rel_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); + shell_exec("tmux respawnp -t $_tmux_session:0.12 'echo \"\033[1;37m\" && cd $_newznab_path && $_php update_releases.php && date && echo \"$_sleep_string $_rel_sleep seconds...\" && sleep $_rel_sleep && echo \"$_string\"' 2>&1 1> /dev/null"); + } + + if ( $_post_to_run >= 2 ) { + if ( $work_remaining_now > 200 ) { + shell_exec("tmux respawnp -t $_tmux_session:2.0 'echo \"\033[0;33m\" && $_php processAlternate2.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t $_tmux_session:2.0 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 200. $_string1\"' 2>&1 1> /dev/null"); + } + } + if ( $_post_to_run >= 3 ) { + if ( $work_remaining_now > 300 ) { + shell_exec("tmux respawnp -t $_tmux_session:2.1 'echo \"\033[0;33m\" && $_php processAlternate3.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t $_tmux_session:2.1 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 300. $_string1\"' 2>&1 1> /dev/null"); + } + } + if ( $_post_to_run >= 4 ) { + if ( $work_remaining_now > 400 ) { + shell_exec("tmux respawnp -t $_tmux_session:2.2 'echo \"\033[0;33m\" && $_php processAlternate4.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t $_tmux_session:2.2 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 400. $_string1\"' 2>&1 1> /dev/null"); + } + } + if ( $_post_to_run >= 5 ) { + if ( $work_remaining_now > 500 ) { + shell_exec("tmux respawnp -t $_tmux_session:2.3 'echo \"\033[0;33m\" && $_php processAlternate5.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t $_tmux_session:2.3 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 500. $_string1\"' 2>&1 1> /dev/null"); + } + } + if ( $_post_to_run >= 6 ) { + if ( $work_remaining_now > 600 ) { + shell_exec("tmux respawnp -t $_tmux_session:2.4 'echo \"\033[0;33m\" && $_php processAlternate6.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t $_tmux_session:2.4 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 600. $_string1\"' 2>&1 1> /dev/null"); + } + } + if ( $_post_to_run >= 7 ) { + if ( $work_remaining_now > 700 ) { + shell_exec("tmux respawnp -t $_tmux_session:2.5 'echo \"\033[0;33m\" && $_php processAlternate7.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t $_tmux_session:2.5 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 700. $_string1\"' 2>&1 1> /dev/null"); + } + } + if ( $_post_to_run >= 8 ) { + if ( $work_remaining_now > 800 ) { + shell_exec("tmux respawnp -t $_tmux_session:2.6 'echo \"\033[0;33m\" && $_php processAlternate8.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t $_tmux_session:2.6 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 800. $_string1\"' 2>&1 1> /dev/null"); + } + } + if ( $_post_to_run >= 9 ) { + if ( $work_remaining_now > 900 ) { + shell_exec("tmux respawnp -t $_tmux_session:2.7 'echo \"\033[0;33m\" && $_php processAlternate9.php && date && echo \"$_string\"' 2>&1 1> /dev/null"); + } else { + shell_exec("tmux respawnp -t $_tmux_session:2.7 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 900. $_string1\"' 2>&1 1> /dev/null"); + } } $i++; } ?> - diff --git a/bin/processAlternate2.php b/bin/processAlternate2.php deleted file mode 100755 index 2dc88ded1..000000000 --- a/bin/processAlternate2.php +++ /dev/null @@ -1,11 +0,0 @@ -processAdditional2(); - -?> - - diff --git a/bin/processAlternate3.php b/bin/processAlternate3.php deleted file mode 100755 index 0ebdea4d5..000000000 --- a/bin/processAlternate3.php +++ /dev/null @@ -1,9 +0,0 @@ -processAdditional3(); - -?> diff --git a/bin/processAlternate4.php b/bin/processAlternate4.php deleted file mode 100755 index d8b4ce78c..000000000 --- a/bin/processAlternate4.php +++ /dev/null @@ -1,11 +0,0 @@ -processAdditional4(); - -?> - - diff --git a/bin/processAlternate5.php b/bin/processAlternate5.php deleted file mode 100755 index 7545812ed..000000000 --- a/bin/processAlternate5.php +++ /dev/null @@ -1,11 +0,0 @@ -processAdditional5(); - -?> - - diff --git a/edit_these.sh b/edit_these.sh index 917a9b263..648568309 100755 --- a/edit_these.sh +++ b/edit_these.sh @@ -11,13 +11,14 @@ export ADMIN_PATH=$NEWZPATH"/www/admin" export CURRENT_DIR=$DIR #Post Processing Additional is the processing that downloads rar and attempts to get info for your site -#you are able to set the number of process to be run from 1-12 +#you are able to set the number of process to be run from 1-9 #trial and error for this and do to the sorting method 1 runs always, 2 if more than 200, 3 more than 300 and so on. -#not implemented, yet -export POST_TO_RUN="1"; +#At some point, increasing this begins to slow things down. It will need to be adjusted for your system +#to get the desired performance +export POST_TO_RUN="1" #Enter the session name to be used by tmux -export TMUX_SESSION="Newznab-master" +export TMUX_SESSION="Newznab-dev" #Set, in seconds - how often the monitor.php (left top pane) script should update, 0 may cause errors export MONITOR_UPDATE="20" diff --git a/start.sh b/start.sh index f4eb95c9c..3f624c832 100755 --- a/start.sh +++ b/start.sh @@ -26,63 +26,56 @@ fi #remove postprocessing scripts rm -f bin/lib/post* +rm -f bin/processAlternate* #create postprocessing scripts -cp $NEWZPATH/www/lib/postprocess.php bin/lib/postprocess2.php -cp $NEWZPATH/www/lib/postprocess.php bin/lib/postprocess3.php -cp $NEWZPATH/www/lib/postprocess.php bin/lib/postprocess4.php -cp $NEWZPATH/www/lib/postprocess.php bin/lib/postprocess5.php +for (( c=2; c<=$POST_TO_RUN; c++ )) +do +d=$((($c - 1) * 100)) +cp $NEWZPATH/www/lib/postprocess.php bin/lib/postprocess$c.php +sed -i -e "s/PostProcess/PostProcess$c/g" bin/lib/postprocess$c.php +sed -i -e "s/processAdditional/processAdditional$c/g" bin/lib/postprocess$c.php +sed -i -e "s/\$tmpPath = \$this->site->tmpunrarpath;/\$tmpPath = \$this->site->tmpunrarpath; \\ + \$tmpPath .= '$c';/g" bin/lib/postprocess$c.php +sed -i -e "s/order by r.postdate desc limit %d.*\$/order by r.guid asc limit %d, %d \", (\$maxattemptstocheckpassworded + 1) * -1, $c * \$numtoProcess, \$numtoProcess));/g" bin/lib/postprocess$c.php +sed -i -e "s/PostPrc : Performing additional post processing.*\$/PostPrc : Performing additional post processing by guid on \".\$rescount.\" releases, starting at $d ...\";/g" bin/lib/postprocess$c.php + +cp bin/lib/processAlternate bin/processAlternate$c.php +sed -i -e "s/1/$c/g" bin/processAlternate$c.php +done + +cp $NEWZPATH/www/lib/postprocess.php bin/lib/postprocess1.php +cp bin/lib/processAlternate bin/processAlternate1.php #edit postprocessing scripts -sed -i -e 's/PostProcess/PostProcess2/g' bin/lib/postprocess2.php -sed -i -e 's/processAdditional/processAdditional2/g' bin/lib/postprocess2.php +sed -i -e 's/PostProcess/PostProcess1/g' bin/lib/postprocess1.php +sed -i -e 's/processAdditional/processAdditional1/g' bin/lib/postprocess1.php sed -i -e 's/$tmpPath = $this->site->tmpunrarpath;/$tmpPath = $this->site->tmpunrarpath; \ - $tmpPath .= '2';/g' bin/lib/postprocess2.php -sed -i -e 's/order by r.postdate desc limit %d.*$/order by r.guid desc limit %d ", ($maxattemptstocheckpassworded + 1) * -1, $numtoProcess));/g' bin/lib/postprocess2.php -sed -i -e 's/PostPrc : Performing additional post processing.*$/PostPrc : Performing additional post processing by guid on ".$rescount." releases ...";/g' bin/lib/postprocess2.php - -sed -i -e 's/PostProcess/PostProcess3/g' bin/lib/postprocess3.php -sed -i -e 's/processAdditional/processAdditional3/g' bin/lib/postprocess3.php -sed -i -e 's/$tmpPath = $this->site->tmpunrarpath;/$tmpPath = $this->site->tmpunrarpath; \ - $tmpPath .= '3';/g' bin/lib/postprocess3.php -sed -i -e 's/order by r.postdate desc limit %d.*$/order by r.guid asc limit %d ", ($maxattemptstocheckpassworded + 1) * -1, $numtoProcess));/g' bin/lib/postprocess3.php -sed -i -e 's/PostPrc : Performing additional post processing.*$/PostPrc : Performing additional post processing by guid on ".$rescount." releases ...";/g' bin/lib/postprocess3.php - -sed -i -e 's/PostProcess/PostProcess4/g' bin/lib/postprocess4.php -sed -i -e 's/processAdditional/processAdditional4/g' bin/lib/postprocess4.php -sed -i -e 's/$tmpPath = $this->site->tmpunrarpath;/$tmpPath = $this->site->tmpunrarpath; \ - $tmpPath .= '4';/g' bin/lib/postprocess4.php -sed -i -e 's/order by r.postdate desc limit %d.*$/order by r.guid asc limit %d, %d ", ($maxattemptstocheckpassworded + 1) * -1, 2 * $numtoProcess, $numtoProcess));/g' bin/lib/postprocess4.php -sed -i -e 's/PostPrc : Performing additional post processing.*$/PostPrc : Performing additional post processing by guid on ".$rescount." releases ...";/g' bin/lib/postprocess4.php - -sed -i -e 's/PostProcess/PostProcess5/g' bin/lib/postprocess5.php -sed -i -e 's/processAdditional/processAdditional5/g' bin/lib/postprocess5.php -sed -i -e 's/$tmpPath = $this->site->tmpunrarpath;/$tmpPath = $this->site->tmpunrarpath; \ - $tmpPath .= '5';/g' bin/lib/postprocess5.php -sed -i -e 's/order by r.postdate desc limit %d.*$/order by r.guid asc limit %d, %d ", ($maxattemptstocheckpassworded + 1) * -1, 4 * $numtoProcess, $numtoProcess));/g' bin/lib/postprocess5.php -sed -i -e 's/PostPrc : Performing additional post processing.*$/PostPrc : Performing additional post processing by guid on ".$rescount." releases ...";/g' bin/lib/postprocess5.php + $tmpPath .= '1';/g' bin/lib/postprocess1.php +sed -i -e 's/order by r.postdate desc limit %d.*$/order by r.guid desc limit %d ", ($maxattemptstocheckpassworded + 1) * -1, $numtoProcess));/g' bin/lib/postprocess1.php +sed -i -e 's/PostPrc : Performing additional post processing.*$/PostPrc : Performing additional post processing by guid on ".$rescount." releases ...";/g' bin/lib/postprocess1.php cp conf/tmux.conf conf/tmux_user.conf $SED -i 's,'changeme,"$NZBS"',' "conf/tmux_user.conf" printf "\033]0; $TMUX_SESSION\007\003\n" -$TMUX -f conf/tmux_user.conf new-session -d -s $TMUX_SESSION -n $TMUX_SESSION 'cd bin && echo "monitor Working......" && nice -n 19 $PHP monitor.php -i 2> /dev/null' +$TMUX -f conf/tmux_user.conf new-session -d -s $TMUX_SESSION -n $TMUX_SESSION 'cd bin && echo "Monitor Started" && echo "It might take a minute for everything to spinup......" && nice -n 19 $PHP monitor.php' $TMUX selectp -t 0 $TMUX splitw -h -p 72 'echo "..."' $TMUX splitw -h -p 50 'echo "..."' $TMUX selectp -t 0 -$TMUX splitw -v -p 65 'echo "..."' -$TMUX splitw -v -p 80 'echo "..."' -$TMUX splitw -v -p 75 'echo "..."' $TMUX splitw -v -p 67 'echo "..."' $TMUX splitw -v -p 50 'echo "..."' -$TMUX selectp -t 6 +#$TMUX splitw -v -p 75 'echo "..."' +#$TMUX splitw -v -p 67 'echo "..."' +#$TMUX splitw -v -p 50 'echo "..."' +$TMUX selectp -t 3 $TMUX splitw -v -p 83 'echo "..."' $TMUX splitw -v -p 80 'echo "..."' $TMUX splitw -v -p 75 'echo "..."' $TMUX splitw -v -p 67 'echo "..."' $TMUX splitw -v -p 50 'echo "..."' -$TMUX selectp -t 12 +$TMUX selectp -t 9 $TMUX splitw -v -p 75 'echo "..."' $TMUX splitw -v -p 67 'echo "..."' $TMUX splitw -v -p 50 'echo "..."'