diff --git a/README.md b/README.md
index 2f6df488d..aa8004f55 100644
--- a/README.md
+++ b/README.md
@@ -24,15 +24,6 @@
php convertToInnoDB.php
```
- * Now, you need to decide which branch you will use, the master branch uses scripts written by andrewit and the dev branch uses scripts written by kevin123. If, you choose the dev branch, skip the next step.
-
- * If, you stay on the master branch, you will need to clone [andrewit's github](https://github.com/itandrew/Newznab-InnoDB-Dropin.git) and get his scripts.
-
- ```bash
- cd /var/www/newznab/misc/testing/
- git clone https://github.com/itandrew/Newznab-InnoDB-Dropin.git innodb
- ```
-
* Now, Clone my github. Theses scripts should be able to run from any path, but this location is where I was asked to put it.
```bash
@@ -41,12 +32,6 @@
cd tmux
```
- * If, you choose the the dev branch, run:
-
- ```bash
- git checkout dev
- ```
-
* Edit the paths, timers, username, what to run and then accept.
```bash
@@ -65,20 +50,20 @@
./start.sh
```
+ * Additional files. I have included prepare.sh to make updating these sctipts alittle easier. I also included a svn updater, svn.sh. It performs a forced updated, which overwrites any changes you may have may to the stock nn+ scripts.
+
* If you connect using **putty**, then under Window/Translation set Remote character set to UTF-8.
- * If something looks stalled, it probably isn't. If all 13 panes are still there, it is most likely, as it should be.
-
- * You must edit **misc/testing/update_cleanup.php** in order for it to actually do something, and update_parsing is good for fixing a few releases everytime it runs, not a silver bullet though.
+ * You must edit any file that is called from **misc/testing/** in order for it to actually do something, and update_parsing is good for fixing a few releases everytime it runs, not a silver bullet though.
- * Now all panes should be running smoothly. If any pane crashes, it should remain open and return to the prompt. You should also be able to see the error that caused it to crash.
+ * Now all panes should be running smoothly. If any script exits early, the error message should be displayed. It will run again during the next monitor cycle.
* Join in the converstion at irc://moonlight.se.eu.synirc.net/newznab-tmux.
- * Thanks go to all who offered their assistance and improvement to these scripts, especially kevin123, zombu2, epsol, DejaVu, ajeffco, pcmerc, zDefect, shat, evermind, coolcheat, sy, ll, crunch, ixio, AlienX, Solution-X, cryogenx. If, your nick is missing from this this, PM and I'll fix it quick.
+ * Thanks go to all who offered their assistance and improvement to these scripts, especially kevin123, zombu2, epsol, DejaVu, ajeffco, pcmerc, zDefect, shat, evermind, coolcheat, sy, ll, crunch, ixio, AlienX, Solution-X, cryogenx, convict, wicked and McFuzz. If, your nick is missing from this this, PM and I'll fix it quick.

diff --git a/bin/monitor.php b/bin/monitor.php
index eedef9aa5..1376432e2 100755
--- a/bin/monitor.php
+++ b/bin/monitor.php
@@ -44,54 +44,31 @@ $parts_query = "SELECT table_rows AS cnt FROM information_schema.TABLES where ta
//parts table size
$parts_size = "SELECT concat(round((data_length+index_length)/(1024*1024*1024),2),'GB') AS cnt FROM information_schema.tables where table_name = 'parts';";
-$_maxdays = getenv('MAXDAYS');
-$backfill_increment = "UPDATE groups set backfill_target=backfill_target+1 where active=1 and backfill_target<$_maxdays;";
-
//initial counts
$releases_start = $db->query($releases_query);
$releases_start = $releases_start[0]['cnt'];
+
+$varnames = shell_exec("cat ../edit_these.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
+$vardata = shell_exec('cat ../edit_these.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"');
+$varnames = explode("\n", $varnames);
+$vardata = explode("\n", $vardata);
+$array = array_combine($varnames, $vardata);
+unset($array['']);
+
//environment
+$backfill_increment = "UPDATE groups set backfill_target=backfill_target+1 where active=1 and backfill_target<{$array['MAXDAYS']};";
$_DB_USER = getenv('DB_USER');
$_DB_HOST = getenv('DB_HOST');
-//$_DB_PASSWORD = getenv('DB_PASSWORD');
$_DB_PASSWORD = escapeshellarg(getenv('DB_PASSWORD'));
$_DB_NAME = getenv('DB_NAME');
-$_backfill = getenv('BACKFILL');
-$_binaries = getenv('BINARIES');
-$_import = getenv('IMPORT');
-$_cleanup = getenv('CLEANUP');
-$_parsing = getenv('PARSING');
-$_optimise = getenv('OPTIMISE');
-$_nzbmulti = getenv('NZBMULTI');
-//$_inno_test = shell_exec('svn info /var/www/newznab | grep inno');
-
-$_admin_path = getenv('ADMIN_PATH');
-$_max_releases = getenv('MAX_RELEASES');
-$_import_max_releases = getenv('IMPORT_MAX_RELEASES');
-$_backfill_max_releases = getenv('BACKFILL_MAX_RELEASES');
-$_nzbs = getenv('NZBS');
-$_nzbs_to_import_begin = count(glob($_nzbs."/*.nzb"));
-$_newznab_path = getenv('NEWZNAB_PATH');
-$_testing_path = getenv('TESTING_PATH');
+$_nzbs_to_import_begin = count(glob($array['NZBS']."/*.nzb"));
$_current_path = dirname(__FILE__);
$_mysql = getenv('MYSQL');
$_php = getenv('PHP');
-$_nntp = getenv('NNTP_SLEEP');
-$_rel_sleep = getenv('RELEASES_SLEEP');
-$_import_sleep = getenv('IMPORT_SLEEP');
-$_backfill_sleep = getenv('BACKFILL_SLEEP');
-$_threads = getenv('THREADS');
-$_innodb = getenv('INNODB');
-$_tmux_session = getenv('TMUX_SESSION');
-$_show_why = getenv('SHOW_WHY');
-$_post_to_run = getenv('POST_TO_RUN');
$_tmux = getenv('TMUXCMD');
-$_cleanup_timer = ('CLEANUP_TIMER');
-$_parsing_timer = ('PARSING_TIMER');
-$_predb_timer = ('PARSING_TIMER');
-if ( $_show_why=="true" ) {
+if ( $array['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";
$_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";
@@ -113,6 +90,15 @@ $time7 = TIME();
$i=1;
while($i>0)
{
+ $varnames = shell_exec("cat ../edit_these.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
+ $vardata = shell_exec('cat ../edit_these.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"');
+ $varnames = explode("\n", $varnames);
+ $vardata = explode("\n", $vardata);
+ $array = array_combine($varnames, $vardata);
+ unset($array['']);
+
+
+
$secs = TIME() - $time;
$mins = floor($secs / 60);
$hrs = floor($mins / 60);
@@ -169,7 +155,7 @@ while($i>0)
$releases_since_loop = $releases_now - $releases_loop;
$additional_releases_now = $releases_now - $book_releases_now - $console_releases_now - $movie_releases_now - $music_releases_now - $pc_releases_now - $tvrage_releases_now;
$total_work_now = $work_remaining_now + $tvrage_releases_proc + $music_releases_proc + $movie_releases_proc + $console_releases_proc + $book_releases_proc;
- $_nzbs_to_import_now = count(glob($_nzbs."/*.nzb"));
+ $_nzbs_to_import_now = count(glob($array['NZBS']."/*.nzb"));
$_nzbs_process = $_nzbs_to_import_begin - $_nzbs_to_import_now;
$parts_rows = $db->query($parts_query);
@@ -199,7 +185,7 @@ while($i>0)
printf("\033[1;31m$releases_since_loop\033[0m releases added in the previous \033[1;31m$sleeptime\033[0m seconds.\n");
printf("\033[1;31m$releases_now($signed$releases_since_start)\033[0m releases in your database.\n");
printf("\033[1;31m$total_work_now\033[0m releases left to postprocess.");
- if ( $_max_releases != 0 ) { printf(" update_binaries, backfill and nzb-import will stop running when you exceed $_max_releases\n\n\033[1;33m"); }
+ if ( $array['MAX_RELEASES'] != 0 ) { printf(" update_binaries, backfill and nzb-import will stop running when you exceed {$array['MAX_RELEASES']}\n\n\033[1;33m"); }
else { printf("\n\n\033[1;33m"); }
$mask = "%16s %10s %10s \n";
@@ -215,194 +201,212 @@ while($i>0)
printf($mask, "TVShows(5000)","$tvrage_releases_proc","$tvrage_releases_now");
printf($mask, "Additional Proc","$work_remaining_now","$additional_releases_now");
$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");
- if ($i==1) {
- sleep(10);
+ if ($i!=1) {
+ printf("\n \033[0mThe parts table has \033[1;31m$parts_rows\033[0m rows and is \033[1;31m$parts_size_gb\n");
}
+ $NNPATH="{$array['NEWZPATH']}/{$array['NEWZNAB_PATH']}";
+
//run update_predb.php in 1.0 ever 15 minutes
- if ((TIME() - $time2) >= $_predb_timer ) {
- 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");
+ if ((TIME() - $time2) >= $array['PREDB_TIMER'] ) {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[1;31m\" && cd $NNPATH && $_php update_predb.php true && date && echo \"$_string\"' 2>&1 1> /dev/null");
$time2 = TIME();
+ } else {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[1;31m\\n\n\nThis pane runs update_predb.php and cycles every {$array['PREDB_TIMER']} seconds.\"'");
}
//run $_php update_parsing.php in 1.1 every 1 hour
- if (((TIME() - $time3) >= $_parsing_timer ) && ($_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");
+ if (((TIME() - $time3) >= $array['PARSING_TIMER'] ) && ($array['PARSING'] == "true" )) {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.1 'echo \"\033[1;32m\" && cd {$array['TESTING_PATH']} && $_php update_parsing.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
$time3 = TIME();
+ } else {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.1 'echo \"\033[1;32m\\n\n\nThis pane runs update_parsing.php and cycles every {$array['PARSING_TIMER']} seconds.\"'");
}
+
//run $_php removespecial.php and $_php update_cleanup.php in 1.2 ever 1 hour
- if (((TIME() - $time7) >= $_cleanup_timer ) && ($_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");
+ if (((TIME() - $time7) >= $array['CLEANUP_TIMER'] ) && ($array['CLEANUP'] == "true" )) {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.2 'echo \"\033[1;33m\" && cd {$array['TESTING_PATH']} && $_php removespecial.php && $_php update_cleanup.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
$time7 = TIME();
+ } else {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.2 'echo \"\033[1;33m\\n\n\nThis pane runs removespecial.php and update_cleanup.php and cycles every {$array['CLEANUP_TIMER']} seconds.\"'");
}
//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");
+ if (((TIME() - $time4) >= $array['TVRAGE_TIMER']) || ($i == 1 )) {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.3 'echo \"\033[1;34m\" && cd $NNPATH && $_php update_tvschedule.php && $_php update_theaters.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
$time4 = TIME();
+ } else {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.3 'echo \"\033[1;34m\\n\n\nThis pane runs update_tvschedule.php update_theaters.php and cycles every {$array['TVRAGE_TIMER']} seconds.\"'");
}
- 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 optimize_innodb.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
- $time5 = TIME();
- }
+
+ if ((TIME() - $time5 >= 7200 ) && ( $array['INNODB']== "true" ) && ( $array['OPTIMISE'] == "true" )) {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[1;36m\" && cd bin && $_php optimize_innodb.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ $time5 = TIME();
+ } else {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[1;36m\\n\n\nThis pane runs optimize_innodb.php and cycles every 7200 seconds.\"'");
}
- 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 optimize_myisam.php true && $_php optimize_innodb.php true && date && echo \"$_string\"' 2>&1 1> /dev/null");
+
+ if ((TIME() - $time6 >= 86400 ) && ( $array['INNODB']== "true" ) && ( $array['OPTIMISE'] == "true" )) {
+ shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:1.5 'echo \"\033[1;37m\" && cd bin && $_php optimize_myisam.php true && $_php optimize_innodb.php true && date && echo \"$_string\"' 2>&1 1> /dev/null");
$time6 = TIME();
- }
+ } else {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.5 'echo \"\033[1;36m\\n\n\nThis pane runs optimize_myisam.php true and optimize_innodb.php true and cycles every 24 hours.\"'");
}
+
//check if scripts need to be started
if ( $nfo_remaining_now > 0 ) {
- 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");
+ shell_exec("$_tmux respawnp -t {$array['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.1 'echo \"\033[1;32m\n$nfo_remaining_now\033[1;33m nfos to process. $_string1\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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;33m\" && cd bin && $_php processAlternate1.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"$_string1\"' 2>&1 1> /dev/null");
}
if ( $book_releases_proc > 0 ) {
- 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");
+ shell_exec("$_tmux respawnp -t {$array['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.3 'echo \"\033[1;34m\n$book_releases_proc\033[1;33m books to process. $_string1\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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.4 'echo \"\033[1;35m\" && cd bin && $_php processGames.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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.4 'echo \"\033[1;36m\n$console_releases_proc\033[1;33m console to process. $_string1\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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.5 'echo \"\033[1;37m\" && cd bin && $_php processMovies.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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.5 'echo \"\033[1;37m\n$movie_releases_proc\033[1;33m movies to process. $_string1\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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.6 'echo \"\033[1;31m\" && cd bin && $_php processMusic.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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.6 '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 {$array['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.7 'echo \"\033[1;32m\" && cd bin && $_php processTv.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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.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 {$array['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.8 'echo \"\033[1;33m\" && cd bin && $_php processOthers.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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;
+ if ( $array['THREADS'] == "true" ) {
$_backfill_cmd = 'backfill_threaded.php';
$_update_cmd = 'update_binaries_threaded.php';
} else {
- $_update_path = $_newznab_path;
$_backfill_cmd = 'backfill.php';
$_update_cmd = 'update_binaries.php';
}
- if ( $_nzbmulti == "true" ){
- $nzb_cmd = "$_php nzb-import-sub.php \"$_nzbs\"";
+ if ( $array['NZBMULTI'] == "true" ){
+ $nzb_cmd = "$_php nzb-import-sub.php \"{$array['NZBS']}\"";
} else {
- $nzb_cmd = "$_php nzb-import.php \"$_nzbs\" true";
+ $nzb_cmd = "$_php nzb-import.php \"{$array['NZBS']}\" true";
}
- if ( $_binaries == "true" ) {
- if (( $total_work_now < $_max_releases ) || ( $_max_releases == 0 )) {
- 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");
+ if ( $array['BINARIES'] == "true" ) {
+ if (( $total_work_now < $array['MAX_RELEASES'] ) || ( $array['MAX_RELEASES'] == 0 )) {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.9 'echo \"\033[1;34m\" && cd $NNPATH && $_php $_update_cmd && date && echo \"$_sleep_string {$array['NNTP_SLEEP']} seconds...\" && sleep {$array['NNTP_SLEEP']} && echo \"$_string\"' 2>&1 1> /dev/null");
} else {
- shell_exec("$_tmux respawnp -t $_tmux_session:0.9 'echo \"$_string2\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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.10 'echo \"\033[1;35m\" && cd $_update_path && $_php $_backfill_cmd && \
+ if ( $array['BACKFILL'] == "true" ) {
+ if (( $total_work_now < $array['BACKFILL_MAX_RELEASES'] ) || ( $array['BACKFILL_MAX_RELEASES'] == 0 )) {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.10 'echo \"\033[1;35m\" && cd $NNPATH && $_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");
+ date && echo \"$_sleep_string {$array['BACKFILL_SLEEP']} seconds...\" && sleep {$array['BACKFILL_SLEEP']} && echo \"$_string\"' 2>&1 1> /dev/null");
} else {
- shell_exec("$_tmux respawnp -t $_tmux_session:0.10 'echo \"$_string2\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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.11 'echo \"\033[1;36m\" && cd bin && $nzb_cmd && echo \" \" && date && echo \"$_sleep_string $_import_sleep seconds...\" && sleep $_import_sleep && echo \"$_string\"' 2>&1 1> /dev/null");
+ if ( $array['IMPORT'] == "true" ) {
+ if (( $total_work_now < $array['IMPORT_MAX_RELEASES'] ) || ( $array['IMPORT_MAX_RELEASES'] == 0 )) {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.11 'echo \"\033[1;36m\" && cd bin && $nzb_cmd && echo \" \" && date && echo \"$_sleep_string {$array['IMPORT_SLEEP']} seconds...\" && sleep {$array['IMPORT_SLEEP']} && echo \"$_string\"' 2>&1 1> /dev/null");
} else {
- shell_exec("$_tmux respawnp -t $_tmux_session:0.11 'echo \"\n$_string2\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.11 'echo \"\n$_string2\"' 2>&1 1> /dev/null");
}
}
- if (( $_optimise == "true" ) && ( ($i % 5) == 0 )) {
- 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");
+ if (( $array['OPTIMISE'] == "true" ) && ( ($i % 5) == 0 )) {
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.12 'echo \"\033[1;37m\" && cd $NNPATH && $_php update_releases.php && cd $_current_path && $_php optimize_myisam.php && date && echo \"$_sleep_string {$array['RELEASES_SLEEP']} seconds...\" && sleep {$array['RELEASES_SLEEP']} && echo \"$_string\"' 2>&1 1> /dev/null");
} else {
- shell_exec("$_tmux respawnp -t $_tmux_session:0.12 'echo \"\033[1;37m\" && cd $_newznab_path && $_php update_releases.php && cd $_current_path && date && echo \"$_sleep_string $_rel_sleep seconds...\" && sleep $_rel_sleep && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.12 'echo \"\033[1;37m\" && cd $NNPATH && $_php update_releases.php && cd $_current_path && date && echo \"$_sleep_string {$array['RELEASES_SLEEP']} seconds...\" && sleep {$array['RELEASES_SLEEP']} && echo \"$_string\"' 2>&1 1> /dev/null");
}
- if ( $_post_to_run >= 2 ) {
+ if ( $array['POST_TO_RUN'] >= 2 ) {
if ( $work_remaining_now > 200 ) {
- shell_exec("$_tmux respawnp -t $_tmux_session:2.0 'echo \"\033[0;33m\" && cd bin && $_php processAlternate2.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.0 'echo \"\033[0;33m\" && cd bin && $_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");
+ shell_exec("$_tmux respawnp -t {$array['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 ( $array['POST_TO_RUN'] >= 3 ) {
if ( $work_remaining_now > 300 ) {
- shell_exec("$_tmux respawnp -t $_tmux_session:2.1 'echo \"\033[0;33m\" && cd bin && $_php processAlternate3.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.1 '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:2.1 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 300. $_string1\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['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 ( $array['POST_TO_RUN'] >= 4 ) {
if ( $work_remaining_now > 400 ) {
- shell_exec("$_tmux respawnp -t $_tmux_session:2.2 'echo \"\033[0;33m\" && cd bin && $_php processAlternate4.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.2 'echo \"\033[0;33m\" && cd bin && $_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");
+ shell_exec("$_tmux respawnp -t {$array['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 ( $array['POST_TO_RUN'] >= 5 ) {
if ( $work_remaining_now > 500 ) {
- shell_exec("$_tmux respawnp -t $_tmux_session:2.3 'echo \"\033[0;33m\" && cd bin && $_php processAlternate5.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.3 'echo \"\033[0;33m\" && cd bin && $_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");
+ shell_exec("$_tmux respawnp -t {$array['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 ( $array['POST_TO_RUN'] >= 6 ) {
if ( $work_remaining_now > 600 ) {
- shell_exec("$_tmux respawnp -t $_tmux_session:2.4 'echo \"\033[0;33m\" && cd bin && $_php processAlternate6.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.4 'echo \"\033[0;33m\" && cd bin && $_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");
+ shell_exec("$_tmux respawnp -t {$array['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 ( $array['POST_TO_RUN'] >= 7 ) {
if ( $work_remaining_now > 700 ) {
- shell_exec("$_tmux respawnp -t $_tmux_session:2.5 'echo \"\033[0;33m\" && cd bin && $_php processAlternate7.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.5 'echo \"\033[0;33m\" && cd bin && $_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");
+ shell_exec("$_tmux respawnp -t {$array['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 ( $array['POST_TO_RUN'] >= 8 ) {
if ( $work_remaining_now > 800 ) {
- shell_exec("$_tmux respawnp -t $_tmux_session:2.6 'echo \"\033[0;33m\" && cd bin && $_php processAlternate8.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.6 'echo \"\033[0;33m\" && cd bin && $_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");
+ shell_exec("$_tmux respawnp -t {$array['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 ( $array['POST_TO_RUN'] >= 9 ) {
if ( $work_remaining_now > 900 ) {
- shell_exec("$_tmux respawnp -t $_tmux_session:2.7 'echo \"\033[0;33m\" && cd bin && $_php processAlternate9.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.7 'echo \"\033[0;33m\" && cd bin && $_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");
+ shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.7 'echo \"\033[1;34m\nOnly active when releases to postprocess exceed 900. $_string1\"' 2>&1 1> /dev/null");
}
}
-
- $i++;
+ if ( $array['SHUTDOWN'] == "on" ) {
+ $i++;
+ } else {
+ $i=0;
+ }
}
+shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:0.0 'echo \"\033[1;41;33m\n\n\n\nNewznab-tmux is shutting down\n\nPlease wait for all panes to report \n\n\"Pane is dead\" before terminating this session.\n\nTo terminate this session press Ctrl-a c \n\nand at the prompt type \n\ntmux kill-session -t {$array['TMUX_SESSION']}\"'");
+
+
+
?>
diff --git a/edit_these.sh b/edit_these.sh
index 858b7abe5..42ed6a0ad 100755
--- a/edit_these.sh
+++ b/edit_these.sh
@@ -3,6 +3,11 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#EDIT THESE#
+#This is the shutdown, on/off
+#on, it runs, off and no scripts will be restarted, when all panes are dead, killall tmux
+export SHUTDOWN="on"
+
+#paths
export NEWZPATH="/var/www/newznab"
export NEWZNAB_PATH=$NEWZPATH"/misc/update_scripts"
@@ -105,6 +110,9 @@ export MAX_RELEASES="0"
#How often to update the PreDB in seconds
export PREDB_TIMER="900"
+#How often to update the TV Schedule and the In Theaters in seconds
+export TVRAGE_TIMER="43200"
+
#Specify your SED binary
export SED="/bin/sed"
#export SED="/usr/local/bin/gsed"