many minor changes, added page to show all colors, made pp page 2 not start by default, added formatting to all displayed numbers in monitor, made console page not start by default

This commit is contained in:
jonnyboy
2013-02-18 01:00:25 +01:00
parent 1d5c3cd185
commit 2ee4072be9
6 changed files with 296 additions and 83 deletions
+207 -54
View File
@@ -1,18 +1,18 @@
<?php
require('config.php');
require(dirname(__FILE__) . '/config.php');
require(WWW_DIR.'/lib/postprocess.php');
$db = new DB();
//totals per category in db, results by parentID
$qry="SELECT COUNT( releases.categoryID ) AS cnt, parentID FROM releases RIGHT JOIN category ON releases.categoryID = category.ID WHERE parentID IS NOT NULL GROUP BY parentID;";
$qry = "SELECT COUNT( releases.categoryID ) AS cnt, parentID FROM releases RIGHT JOIN category ON releases.categoryID = category.ID WHERE parentID IS NOT NULL GROUP BY parentID;";
//needs to be processed query
$proc="SELECT ( SELECT COUNT( groupID ) AS cnt from releases where consoleinfoID IS NULL and categoryID BETWEEN 1000 AND 1999 ) AS console, ( SELECT COUNT( groupID ) AS cnt from releases where imdbID IS NULL and categoryID BETWEEN 2000 AND 2999 ) AS movies, ( SELECT COUNT( groupID ) AS cnt from releases where musicinfoID IS NULL and categoryID BETWEEN 3000 AND 3999 ) AS audio, ( SELECT COUNT( groupID ) AS cnt from releases r left join category c on c.ID = r.categoryID where (categoryID BETWEEN 4000 AND 4999 and ((r.passwordstatus between -6 and -1) or (r.haspreview = -1 and c.disablepreview = 0)))) AS pc, ( SELECT COUNT( groupID ) AS cnt from releases where rageID = -1 and categoryID BETWEEN 5000 AND 5999 ) AS tv, ( SELECT COUNT( groupID ) AS cnt from releases where bookinfoID IS NULL and categoryID = 7020 ) AS book, ( SELECT COUNT( groupID ) AS cnt from releases r left join category c on c.ID = r.categoryID where (r.passwordstatus between -6 and -1) or (r.haspreview = -1 and c.disablepreview = 0)) AS work, ( SELECT COUNT( groupID ) AS cnt from releases) AS releases, ( SELECT COUNT( groupID ) AS cnt FROM releases r WHERE r.releasenfoID = 0) AS nforemains, ( SELECT COUNT( groupID ) AS cnt FROM releases WHERE releasenfoID not in (0, -1)) AS nfo, ( SELECT table_rows AS cnt FROM information_schema.TABLES where table_name = 'parts' AND TABLE_SCHEMA = '".DB_NAME."' ) AS parts, ( SELECT concat(round((data_length+index_length)/(1024*1024*1024),2),'GB') AS cnt FROM information_schema.tables where table_name = 'parts' AND TABLE_SCHEMA = '".DB_NAME."' ) AS partsize, ( SELECT UNIX_TIMESTAMP(adddate) from releases order by adddate desc limit 1 ) AS newestadd, ( SELECT name from releases order by adddate desc limit 1 ) AS newestaddname";
$proc = "SELECT ( SELECT COUNT( groupID ) AS cnt from releases where consoleinfoID IS NULL and categoryID BETWEEN 1000 AND 1999 ) AS console, ( SELECT COUNT( groupID ) AS cnt from releases where imdbID IS NULL and categoryID BETWEEN 2000 AND 2999 ) AS movies, ( SELECT COUNT( groupID ) AS cnt from releases where musicinfoID IS NULL and categoryID BETWEEN 3000 AND 3999 ) AS audio, ( SELECT COUNT( groupID ) AS cnt from releases r left join category c on c.ID = r.categoryID where (categoryID BETWEEN 4000 AND 4999 and ((r.passwordstatus between -6 and -1) or (r.haspreview = -1 and c.disablepreview = 0)))) AS pc, ( SELECT COUNT( groupID ) AS cnt from releases where rageID = -1 and categoryID BETWEEN 5000 AND 5999 ) AS tv, ( SELECT COUNT( groupID ) AS cnt from releases where bookinfoID IS NULL and categoryID = 7020 ) AS book, ( SELECT COUNT( groupID ) AS cnt from releases r left join category c on c.ID = r.categoryID where (r.passwordstatus between -6 and -1) or (r.haspreview = -1 and c.disablepreview = 0)) AS work, ( SELECT COUNT( groupID ) AS cnt from releases) AS releases, ( SELECT COUNT( groupID ) AS cnt FROM releases r WHERE r.releasenfoID = 0) AS nforemains, ( SELECT COUNT( groupID ) AS cnt FROM releases WHERE releasenfoID not in (0, -1)) AS nfo, ( SELECT table_rows AS cnt FROM information_schema.TABLES where table_name = 'parts' AND TABLE_SCHEMA = '".DB_NAME."' ) AS parts, ( SELECT concat(round((data_length+index_length)/(1024*1024*1024),2),'GB') AS cnt FROM information_schema.tables where table_name = 'parts' AND TABLE_SCHEMA = '".DB_NAME."' ) AS partsize, ( SELECT UNIX_TIMESTAMP(adddate) from releases order by adddate desc limit 1 ) AS newestadd, ( SELECT name from releases order by adddate desc limit 1 ) AS newestaddname";
//get first release inserted datetime and oldest posted datetime
$posted_date="SELECT(select UNIX_TIMESTAMP(adddate) from releases order by adddate asc limit 1) AS adddate;";
$posted_date = "SELECT(select UNIX_TIMESTAMP(adddate) from releases order by adddate asc limit 1) AS adddate;";
//get variables from config.sh and defaults.sh
$varnames = shell_exec("cat ../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
@@ -29,6 +29,7 @@ $_DB_NAME = getenv('DB_NAME');
$_DB_USER = getenv('DB_USER');
$_DB_HOST = getenv('DB_HOST');
$_DB_PASSWORD = escapeshellarg(getenv('DB_PASSWORD'));
$_DB_PASS = getenv('DB_PASSWORD');
$_mysql = getenv('MYSQL');
$_php = getenv('PHP');
$_tmux = getenv('TMUXCMD');
@@ -39,6 +40,14 @@ $_bin = dirname(__FILE__)."/../bin";
$_alienx = dirname(__FILE__)."/../alienx";
$_conf = dirname(__FILE__)."/../conf";
$_cj = dirname(__FILE__)."/../nnscripts";
$use_addtional=$array['USE_ADDITIONAL'];
$NNPATH="{$array['NEWZPATH']}{$array['NEWZNAB_PATH']}";
$TESTING="{$array['NEWZPATH']}{$array['TESTING_PATH']}";
//build queries for shell
$_backfill_increment = "UPDATE groups set backfill_target=backfill_target+1 where active=1 and backfill_target<{$array['MAXDAYS']};";
$mysql_command_1 = "$_mysql --defaults-extra-file=$_conf/my.cnf -u$_DB_USER -h $_DB_HOST $_DB_NAME -e \"$_backfill_increment\"";
//$mysql_command_1 = "$_mysql -u$_DB_USER -p $_DB_PASSWORD -h $_DB_HOST $_DB_NAME -e \"$_backfill_increment\"";
//got microtime
function microtime_float()
@@ -80,8 +89,10 @@ function relativeTime($_time) {
function get_color()
{
$number = mt_rand(1,231);
if ( $number == 4 || $number == 16 || $number == 17 || $number == 18 || $number == 19 || $number == 52 || $number == 53 || $number == 67 ) { get_color(); }
return($number);
if ( $number != 4 && $number != 16 && $number != 17 && $number != 18 && $number != 19 && $number != 52 && $number != 53 && $number != 67 ) {
return($number);
}
get_color();
}
$time = TIME();
@@ -123,19 +134,122 @@ $nfo_now = 0;
$parts_rows = 0;
$parts_size_gb = 0;
$releases_now = 0;
$firstdate = 0;
$newestname = 0;
$newestdate = 0;
$firstdate = TIME() - 10;
$newestname = "Unknown";
$newestdate = TIME() - 10;
$parts_rows_unformated = 0;
$releases_now_formatted = 0;
$nfo_percent = 0;
$console_percent = 0;
$movie_percent = 0;
$music_percent = 0;
$pc_percent = 0;
$tvrage_percent = 0;
$book_percent = 0;
$misc_percent = 0;
$releases_since_start = 0;
$work_since_start = 0;
$work_since_start_formatted = number_format( $work_since_start );
$total_work_now = 0;
$total_work_now_formatted = 0;
$binaries_state = "disabled";
$binaries_reason = "disabled";
$backfill_state = "disabled";
$backfill_reason = "disabled";
$import_state = "disabled";
$import_reason = "disabled";
$query_timer_start = 0;
$query_timer = 0;
$script_timer = 0;
$script_timer_start = 0;
$lagg=0;
$console_releases_start = 0;
$movie_releases_start = 0;
$music_releases_start = 0;
$pc_releases_start = 0;
$tvrage_releases_start = 0;
$book_releases_start = 0;
$misc_releases_start = 0;
$nfo_start = 0;
$nfo_remaining_start = 0;
$console_releases_proc_start = 0;
$movie_releases_proc_start = 0;
$music_releases_proc_start = 0;
$pc_releases_proc_start = 0;
$tvrage_releases_proc_start = 0;
$book_releases_proc_start = 0;
$work_remaining_start = 0;
//get valuses from $posted_date
$posted_date_result = @$db->query($posted_date);
if ( $posted_date_result[0]['adddate'] ) { $firstdate = $posted_date_result[0]['adddate']; }
//formatted output
$nfo_remaining_since_start = number_format( $nfo_remaining_now - $nfo_remaining_start );
$console_remaining_since_start = number_format( $console_releases_proc - $console_releases_proc_start );
$movie_remaining_since_start = number_format( $movie_releases_proc - $movie_releases_proc_start );
$music_remaining_since_start = number_format( $music_releases_proc - $music_releases_proc_start );
$pc_remaining_since_start = number_format( $pc_releases_proc - $pc_releases_proc_start );
$tvrage_remaining_since_start = number_format( $tvrage_releases_proc - $tvrage_releases_proc_start );
$book_remaining_since_start = number_format( $book_releases_proc - $book_releases_proc_start );
$remaning_since_start = number_format( $work_remaining_now - $work_remaining_start );
$console_releases_proc_formatted = number_format( $console_releases_proc );
$movie_releases_proc_formatted = number_format( $movie_releases_proc );
$music_releases_proc_formatted = number_format( $music_releases_proc );
$pc_releases_proc_formatted = number_format( $pc_releases_proc );
$tvrage_releases_proc_formatted = number_format( $tvrage_releases_proc );
$work_remaining_now_formatted = number_format( $work_remaining_now );
$book_releases_proc_formatted = number_format( $book_releases_proc );
$nfo_remaining_now_formatted = number_format( $nfo_remaining_now );
$nfo_now_formatted = number_format( $nfo_now );
$console_releases_now_formatted = number_format( $console_releases_now );
$movie_releases_now_formatted = number_format( $movie_releases_now );
$music_releases_now_formatted = number_format( $music_releases_now );
$pc_releases_now_formatted = number_format( $pc_releases_now );
$tvrage_releases_now_formatted = number_format( $tvrage_releases_now );
$book_releases_now_formatted = number_format( $book_releases_now );
$misc_releases_now_formatted = number_format( $misc_releases_now );
//create initial display
passthru('clear');
printf("\033[1;31m Monitor\033[0m has been running for:\033[0m ".relativeTime("$time")."\n");
printf("\033[1;31m First insert:\033[0m ".relativeTime("$firstdate")."\n");
printf("\033[1;31m Newest Release:\033[0m $newestname\n");
printf("\033[1;31m Added:\033[0m ".relativeTime("$newestdate")."\n");
$i=1;
while($i>0)
$mask = "%20s %20.20s %20.20s\n";
printf("\033[1;33m\n");
printf($mask, "Category", "State", "Reason");
printf($mask, "==================", "==================", "==================");
printf("\033[38;5;214m");
printf($mask, "Binaries", "$binaries_state", "$binaries_reason");
printf($mask, "Backfill", "$backfill_state", "$backfill_reason");
printf($mask, "Import", "$import_state", "$import_reason");
printf($mask, "Parts", "$parts_size_gb", "$parts_rows rows");
printf("\033[1;33m\n");
printf($mask, "Category", "In Process", "In Database");
printf($mask, "==================", "==================", "==================");
printf("\033[38;5;214m");
printf($mask, "NFO's","$nfo_remaining_now_formatted($nfo_remaining_since_start)","$nfo_now_formatted($nfo_percent%)");
printf($mask, "Console(1000)","$console_releases_proc_formatted($console_remaining_since_start)","$console_releases_now_formatted($console_percent%)");
printf($mask, "Movie(2000)","$movie_releases_proc_formatted($movie_remaining_since_start)","$movie_releases_now_formatted($movie_percent%)");
printf($mask, "Audio(3000)","$music_releases_proc_formatted($music_remaining_since_start)","$music_releases_now_formatted($music_percent%)");
printf($mask, "PC(4000)","$pc_releases_proc_formatted($pc_remaining_since_start)","$pc_releases_now_formatted($pc_percent%)");
printf($mask, "TVShows(5000)","$tvrage_releases_proc_formatted($tvrage_remaining_since_start)","$tvrage_releases_now_formatted($tvrage_percent%)");
printf($mask, "Books(7000)","$book_releases_proc_formatted($book_remaining_since_start)","$book_releases_now_formatted($book_percent%)");
printf($mask, "Misc(8000)","$work_remaining_now_formatted($remaning_since_start)","$misc_releases_now_formatted($misc_percent%)");
printf($mask, "Total", "$total_work_now_formatted($work_since_start_formatted)", "$releases_now_formatted($releases_since_start)");
printf("\n\033[1;33m");
printf($mask, "Category", "Time", "Status");
printf($mask, "==================", "==================", "==================");
printf("\033[38;5;214m");
printf($mask, "Queries","$query_timer","queried");
printf($mask, "Check Scripts","$script_timer","started");
printf($mask, "Total Lagg","$lagg","complete");
$i = 1;
while( $i > 0 )
{
//get microtime at start of loop
$time_loop_start = microtime_float();
@@ -174,10 +288,27 @@ while($i>0)
}
$proc_result = @$db->query($proc);
//get valuses from $posted_date
$posted_date_result = @$db->query($posted_date);
if ( $posted_date_result[0]['adddate'] ) { $firstdate = $posted_date_result[0]['adddate']; }
//initial query for total releases
if (( $proc_result[0]['work'] != NULL ) && ( $work_start == 0 )) { $work_start = $proc_result[0]['work']; }
if (( $proc_result[0]['releases'] ) && ( $releases_start == 0 )) { $releases_start = $proc_result[0]['releases']; }
//get start values from $qry
if ( $i == "1" )
{
if ( $proc_result[0]['nforemains'] != NULL ) { $nfo_remaining_start = $proc_result[0]['nforemains']; }
if ( $proc_result[0]['console'] != NULL ) { $console_releases_proc_start = $proc_result[0]['console']; }
if ( $proc_result[0]['movies'] != NULL ) { $movie_releases_proc_start = $proc_result[0]['movies']; }
if ( $proc_result[0]['audio'] != NULL ) { $music_releases_proc_start = $proc_result[0]['audio']; }
if ( $proc_result[0]['pc'] != NULL ) { $pc_releases_proc_start = $proc_result[0]['pc']; }
if ( $proc_result[0]['tv'] != NULL ) { $tvrage_releases_proc_start = $proc_result[0]['tv']; }
if ( $proc_result[0]['book'] != NULL ) { $book_releases_proc_start = $proc_result[0]['book']; }
if ( $proc_result[0]['work'] != NULL ) { $work_remaining_start = $proc_result[0]['work']; }
}
//get values from $qry
if ( $initquery['1000'] != NULL ) { $console_releases_now = $initquery['1000']; }
if ( $initquery['2000'] != NULL ) { $movie_releases_now = $initquery['2000']; }
@@ -189,6 +320,7 @@ while($i>0)
//get values from $proc
if ( $proc_result[0]['console'] != NULL ) { $console_releases_proc = $proc_result[0]['console']; }
if ( $proc_result[0]['console'] != NULL ) { $console_releases_proc_formatted = number_format($proc_result[0]['console']); }
if ( $proc_result[0]['movies'] != NULL ) { $movie_releases_proc = $proc_result[0]['movies']; }
if ( $proc_result[0]['audio'] != NULL ) { $music_releases_proc = $proc_result[0]['audio']; }
if ( $proc_result[0]['pc'] != NULL ) { $pc_releases_proc = $proc_result[0]['pc']; }
@@ -206,19 +338,46 @@ while($i>0)
if ( $proc_result[0]['newestaddname'] ) { $newestname = $proc_result[0]['newestaddname']; }
if ( $proc_result[0]['newestadd'] ) { $newestdate = $proc_result[0]['newestadd']; }
//build queries for shell
$_backfill_increment = "UPDATE groups set backfill_target=backfill_target+1 where active=1 and backfill_target<{$array['MAXDAYS']};";
$mysql_command_1 = "$_mysql --defaults-extra-file=$_conf/my.cnf -u$_DB_USER -h $_DB_HOST $_DB_NAME -e \"$_backfill_increment\"";
//$mysql_command_1 = "$_mysql -u$_DB_USER -p $_DB_PASSWORD -h $_DB_HOST $_DB_NAME -e \"$_backfill_increment\"";
//calculate releases difference
$releases_since_start = $releases_now - $releases_start;
$releases_since_start = number_format($releases_since_start);
$work_since_start = $work_remaining_now - $work_start;
$releases_remaining_since_start = number_format( $releases_now - $releases_start );
$releases_since_start = number_format( $releases_now - $releases_start );
$work_remaining_since_start = $work_remaining_now - $work_remaining_start;
$work_since_start = $work_remaining_now - $work_remaining_start;
$work_since_start_formatted = number_format($work_since_start);
$total_work_now = $work_remaining_now + $tvrage_releases_proc + $music_releases_proc + $movie_releases_proc + $console_releases_proc + $book_releases_proc;
$total_work_now_formatted = number_format($total_work_now);
if ( $releases_now != 0 ) {
$nfo_remaining_since_start = ( $nfo_remaining_now - $nfo_remaining_start );
$console_remaining_since_start = ( $console_releases_proc - $console_releases_proc_start );
$movie_remaining_since_start = ( $movie_releases_proc - $movie_releases_proc_start );
$music_remaining_since_start = ( $music_releases_proc - $music_releases_proc_start );
$pc_remaining_since_start = ( $pc_releases_proc - $pc_releases_proc_start );
$tvrage_remaining_since_start = ( $tvrage_releases_proc - $tvrage_releases_proc_start );
$book_remaining_since_start = ( $book_releases_proc - $book_releases_proc_start );
$remaning_since_start = ( $work_remaining_now - $work_remaining_start );
//formatted output
$console_releases_proc_formatted = number_format( $console_releases_proc );
$movie_releases_proc_formatted = number_format( $movie_releases_proc );
$music_releases_proc_formatted = number_format( $music_releases_proc );
$pc_releases_proc_formatted = number_format( $pc_releases_proc );
$tvrage_releases_proc_formatted = number_format( $tvrage_releases_proc );
$work_remaining_now_formatted = number_format( $work_remaining_now );
$book_releases_proc_formatted = number_format( $book_releases_proc );
$nfo_remaining_now_formatted = number_format( $nfo_remaining_now );
$nfo_now_formatted = number_format( $nfo_now );
$console_releases_now_formatted = number_format( $console_releases_now );
$movie_releases_now_formatted = number_format( $movie_releases_now );
$music_releases_now_formatted = number_format( $music_releases_now );
$pc_releases_now_formatted = number_format( $pc_releases_now );
$tvrage_releases_now_formatted = number_format( $tvrage_releases_now );
$book_releases_now_formatted = number_format( $book_releases_now );
$misc_releases_now_formatted = number_format( $misc_releases_now );
if ( $releases_now != 0 ) {
$nfo_percent = floor(( $nfo_now / $releases_now) * 100 );
$console_percent = floor(( $console_releases_now / $releases_now) * 100 );
$movie_percent = floor(( $movie_releases_now / $releases_now) * 100 );
@@ -286,46 +445,40 @@ while($i>0)
//get microtime at end of queries
$query_timer = microtime_float()-$query_timer_start;
if ( $releases_since_start > 0 ) { $signed = "+"; }
else { $signed = ""; }
if ( $work_since_start > 0 ) { $signed1 = "+"; }
else { $signed1 = ""; }
//update display
passthru('clear');
printf("\033[1;31m Monitor\033[0m has been running for:\033[0m ".relativeTime("$time")."\n");
printf("\033[1;31m First insert:\033[0m ".relativeTime("$firstdate")."\n");
printf("\033[1;31m Newest Release:\033[0m $newestname\n");
printf("\033[1;31m Added:\033[0m ".relativeTime("$newestdate")."\n");
printf("\033[1;31m $releases_now_formatted($signed$releases_since_start)\033[0m releases in your database.\n");
printf("\033[1;31m $total_work_now_formatted($signed1$work_since_start)\033[0m releases left to postprocess.\033[1;33m\n");
$mask = "%20s %15.15s %15s \n";
printf("\033[1;33m\n");
printf($mask, "Category", "State", "Reason");
printf($mask, "===============", "===============", "===============\033[0m");
printf($mask, "==================", "==================", "==================");
printf("\033[38;5;214m");
printf($mask, "Binaries", "$binaries_state", "$binaries_reason");
printf($mask, "Backfill", "$backfill_state", "$backfill_reason");
printf($mask, "Import", "$import_state", "$import_reason");
printf($mask, "Parts", "$parts_rows", "$parts_size_gb");
printf($mask, "Parts", "$parts_size_gb", "$parts_rows rows");
printf("\033[1;33m\n");
printf($mask, "Category", "In Process", "In Database");
printf($mask, "===============", "===============", "===============\033[0m");
printf($mask, "NFO's","$nfo_remaining_now","$nfo_now($nfo_percent%)");
printf($mask, "Console(1000)","$console_releases_proc","$console_releases_now($console_percent%)");
printf($mask, "Movie(2000)","$movie_releases_proc","$movie_releases_now($movie_percent%)");
printf($mask, "Audio(3000)","$music_releases_proc","$music_releases_now($music_percent%)");
printf($mask, "PC(4000)","$pc_releases_proc","$pc_releases_now($pc_percent%)");
printf($mask, "TVShows(5000)","$tvrage_releases_proc","$tvrage_releases_now($tvrage_percent%)");
printf($mask, "Books(7000)","$book_releases_proc","$book_releases_now($book_percent%)");
printf($mask, "Misc(8000)","$work_remaining_now","$misc_releases_now($misc_percent%)");
$NNPATH="{$array['NEWZPATH']}{$array['NEWZNAB_PATH']}";
$TESTING="{$array['NEWZPATH']}{$array['TESTING_PATH']}";
printf($mask, "==================", "==================", "==================");
printf("\033[38;5;214m");
printf($mask, "NFO's","$nfo_remaining_now_formatted($nfo_remaining_since_start)","$nfo_now_formatted($nfo_percent%)");
printf($mask, "Console(1000)","$console_releases_proc_formatted($console_remaining_since_start)","$console_releases_now_formatted($console_percent%)");
printf($mask, "Movie(2000)","$movie_releases_proc_formatted($movie_remaining_since_start)","$movie_releases_now_formatted($movie_percent%)");
printf($mask, "Audio(3000)","$music_releases_proc_formatted($music_remaining_since_start)","$music_releases_now_formatted($music_percent%)");
printf($mask, "PC(4000)","$pc_releases_proc_formatted($pc_remaining_since_start)","$pc_releases_now_formatted($pc_percent%)");
printf($mask, "TVShows(5000)","$tvrage_releases_proc_formatted($tvrage_remaining_since_start)","$tvrage_releases_now_formatted($tvrage_percent%)");
printf($mask, "Books(7000)","$book_releases_proc_formatted($book_remaining_since_start)","$book_releases_now_formatted($book_percent%)");
printf($mask, "Misc(8000)","$work_remaining_now_formatted($remaning_since_start)","$misc_releases_now_formatted($misc_percent%)");
printf($mask, "Total", "$total_work_now_formatted($work_since_start_formatted)", "$releases_now_formatted($releases_since_start)");
printf("\n\033[1;33m");
printf($mask, "Category", "Time", "Status");
printf($mask, "===============", "===============", "===============\033[0m");
printf($mask, "==================", "==================", "==================");
printf("\033[38;5;214m");
printf($mask, "Queries","$query_timer","queried");
//get microtime for timing script check
@@ -547,7 +700,7 @@ while($i>0)
if (( $array['POST_TO_RUN'] >= $g ) && ( $work_remaining_now > $f ) && ( $g <= 16 )) {
$color = get_color();
shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\" && $ds1 postprocess_$g $ds2 && cd $_bin && $_php processAlternate$g.php && echo \" \033[1;0;33m\" && $ds1 postprocess_$g $ds3' 2>&1 1> /dev/null");
} elseif (( $array['POST_TO_RUN'] >= $g ) && ( $work_remaining_now > $f ) && ( $g > 16 )) {
} elseif (( $array['POST_TO_RUN'] >= $g ) && ( $work_remaining_now > $f ) && ( $g > 16 ) && ( $use_addtional == "true" )) {
$h=$g-17;
$color = get_color();
shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:3.$h 'echo \"\033[38;5;\"$color\"m\" && $ds1 postprocess_$g $ds2 && cd $_bin && $_php processAlternate$g.php && echo \" \033[1;0;33m\" && $ds1 postprocess_$g $ds3' 2>&1 1> /dev/null");
@@ -561,7 +714,7 @@ while($i>0)
if ( $g <= 15 ) {
$color = get_color();
shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:2.$g 'echo \"\033[38;5;\"$color\"m\n\nThis is color #\"$color'");
} elseif ( $g > 15 ) {
} elseif (( $g > 15 ) && ( $use_addtional == "true" )) {
$h=$g-16;
$color = get_color();
shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:3.$h 'echo \"\033[38;5;\"$color\"m\n\nThis is color #\"$color'");
@@ -571,6 +724,11 @@ while($i>0)
//get microtime and calculate time
$script_timer = microtime_float() - $script_timer_start;
//display all 256 colors
if ( $array['SHOW_COLORS'] == "true" ) {
shell_exec("$_tmux new-window -t {$array['TMUX_SESSION']} -n Colors 'cd $_bin && ./show_colors.sh'");
}
//continue table
printf($mask, "Check Scripts","$script_timer","started");
$lagg=microtime_float()-$time_loop_start;
@@ -595,9 +753,4 @@ while($i>0)
}
sleep($array['MONITOR_UPDATE']);
}
//shutdown message
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']}\"'");
?>
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
while :
do
for fgbg in 38 48 ; do #Foreground/Background
for color in {0..256} ; do #Colors
#Display the color
echo -en "\e[${fgbg};5;${color}m ${color} \e[0m"
#Display 10 colors per lines
if [ $((($color + 1) % 10)) == 0 ] ; then
echo #New line
fi
done
echo #New line
done
sleep 300
done
+2 -1
View File
@@ -79,7 +79,8 @@ if ($ps->RunThreadCode())
$dir = dirname(__FILE__).'/../../../';
$file = 'update_binaries.php';
$output = shell_exec("php {$dir}/{$file} {$param}");
//$output = shell_exec("php {$dir}/{$file} {$param}");
$output = passthru("php {$dir}/{$file} {$param}");
//$output = shell_exec("/usr/bin/php -c /etc/php5/cli/php.ini {$dir}/{$file} {$param}");
echo "[Thread-{$thread}] Completed update for group {$group['name']}\n";
+23 -2
View File
@@ -25,14 +25,19 @@ export ADMIN_PATH=$NEWZPATH"/www/admin"
############################################################
#Post Processing Additional is the post processing that downloads rar files and attempts to get info for your site
#you are able to set the number of process to be run from 1-32, remember that each process uses 1 of your nntp connections
#so, if you have 20, and you set this to 32, you will have errors, lots of errors, nfo lookup uses 1 connection
#you are able to set the number of process to be run from 1-16, remember that each process uses 1 of your nntp connections
#so, if you have 20, and you set this to 16, you will have errors, lots of errors, nfo lookup uses 1 connection
#binaries and backfill threaded default to 10 connections each and predb uses 1, so understand how many connections you are using when setting
#trial and error for this, 1 runs always, 2 if more than 200, 3 more than 300 and so on.
#At some point, increasing this begins to slow things down. It will need to be adjusted for your system
#to get the desired performance, 0 will disable all post processing
export POST_TO_RUN="1"
#there can be an addition 16 postprocesses for 32 postprocess to run, if you are enable this, then another window will be created
#to run the additional processes, if you are using less than 16, this window will be idle
#this can not be changed while script is running, any change will be ignored
export USE_ADDITIONAL="false"
#Enter the session name to be used by tmux
export TMUX_SESSION="Newznab"
@@ -246,6 +251,9 @@ export USE_MYTOP="false"
export USE_VNSTAT="false"
export USE_IFTOP="false"
#an additional window can be created manually with Ctrl-a c or it can be created at start of script
export USE_CONSOLE="false"
############################################################
#Use powerline scripts to display the status bar
@@ -290,7 +298,20 @@ export NEWZDASH_URL=""
#update_svn.sh is destructive, it update your version to match th esvn version
export SVN_PASSWORD="password"
#running update_svn as root will change file ownership of every file in the svn path
#to chown -R the path, enable and set user/group
#newznab/nzbfiles is not chown'd
export CHOWN_TRUE="false"
export WWW_USER="www-data:www-data"
###########################################################
#colors display differently on every monitor, if you are having difficulty seeing a particular
#color, set this to true, get the colors number and report is to me, I will remove it
export SHOW_COLORS="false"
###########################################################
#By using this script you understand that the programmer is not responsible for any loss of data, users, or sanity.
#You also agree that you were smart enough to make a backup of your database and files. Do you agree? yes/no
export AGREED="no"
+9
View File
@@ -48,6 +48,15 @@ if [[ $KEVINS_COMP == "true" ]]; then
cp -frv * $NEWZPATH/www/lib/
fi
#set user/group to www
if [[ $CHOWN_TRUE == "true" ]]; then
chown -c $WWW_USER $NEWZPATH
chown -Rc $WWW_USER $NEWZPATH/www/
chown -Rc $WWW_USER $NEWZPATH/db/
chown -Rc $WWW_USER $NEWZPATH/docs/
chown -Rc $WWW_USER $NEWZPATH/misc/
fi
#set prmission
cd $NEWZPATH"/misc/update_scripts/nix_scripts/tmux/scripts"
./set_perms.sh
+32 -26
View File
@@ -38,7 +38,7 @@ if $TMUXCMD -q has-session -t $TMUX_SESSION; then
else
printf "The above is just a notice, it is saying, that you do not have a session currently running. It is not an error."
printf "\033]0; $TMUX_SESSION\007\003\n"
$TMUXCMD -f $TMUX_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'
$TMUXCMD -f $TMUX_CONF new-session -d -s $TMUX_SESSION -n Monitor 'cd bin && echo "Monitor Started" && echo "It might take a minute for everything to spinup......" && $NICE -n 19 $PHP monitor.php'
if [ ! -f $NEWZPATH/www/lib/postprocess.php.orig ]; then
cp $NEWZPATH/www/lib/postprocess.php $NEWZPATH/www/lib/postprocess.php.orig
@@ -148,7 +148,7 @@ else
$TMUXCMD splitw -h -p 65 'echo "..."'
$TMUXCMD splitw -h -p 60 'echo "..."'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -v -p 30 'echo "..."'
$TMUXCMD splitw -v -p 50 'echo "..."'
$TMUXCMD splitw -v -p 50 'echo "..."'
$TMUXCMD selectp -t 3
@@ -161,8 +161,10 @@ else
$TMUXCMD splitw -v -p 50 'echo "..."'
$TMUXCMD selectp -t 9
$TMUXCMD splitw -v -p 75 'echo "..."'
$TMUXCMD splitw -v -p 67 'echo "..."'
$TMUXCMD splitw -v -p 50 'echo "..."'
$TMUXCMD selectp -t 9
$TMUXCMD splitw -v -p 50 'echo "..."'
$TMUXCMD selectp -t 11
$TMUXCMD splitw -v -p 50 'echo "..."'
$TMUXCMD new-window -n cleanup 'echo "..."'
@@ -175,7 +177,7 @@ else
$TMUXCMD splitw -h -p 67 'echo "..."'
$TMUXCMD splitw -h -p 50 'echo "..."'
$TMUXCMD new-window -n postprocessing1 'echo "..."'
$TMUXCMD new-window -n post1 'echo "..."'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -v -p 50 'echo "..."'
$TMUXCMD selectp -t 0
@@ -196,26 +198,28 @@ else
$TMUXCMD splitw -h -p 50 'echo "..."'
$TMUXCMD select-layout tiled
$TMUXCMD new-window -n postprocessing2 'echo "..."'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -v -p 50 'echo "..."'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -h -p 88 'echo "..."'
$TMUXCMD splitw -h -p 85 'echo "..."'
$TMUXCMD splitw -h -p 83 'echo "..."'
$TMUXCMD splitw -h -p 80 'echo "..."'
$TMUXCMD splitw -h -p 75 'echo "..."'
$TMUXCMD splitw -h -p 67 'echo "..."'
$TMUXCMD splitw -h -p 50 'echo "..."'
$TMUXCMD selectp -t 8
$TMUXCMD splitw -h -p 88 'echo "..."'
$TMUXCMD splitw -h -p 85 'echo "..."'
$TMUXCMD splitw -h -p 83 'echo "..."'
$TMUXCMD splitw -h -p 80 'echo "..."'
$TMUXCMD splitw -h -p 75 'echo "..."'
$TMUXCMD splitw -h -p 67 'echo "..."'
$TMUXCMD splitw -h -p 50 'echo "..."'
$TMUXCMD select-layout tiled
if [[ $USE_ADDITIONAL == "true" ]]; then
$TMUXCMD new-window -n post2 'echo "..."'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -v -p 50 'echo "..."'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -h -p 88 'echo "..."'
$TMUXCMD splitw -h -p 85 'echo "..."'
$TMUXCMD splitw -h -p 83 'echo "..."'
$TMUXCMD splitw -h -p 80 'echo "..."'
$TMUXCMD splitw -h -p 75 'echo "..."'
$TMUXCMD splitw -h -p 67 'echo "..."'
$TMUXCMD splitw -h -p 50 'echo "..."'
$TMUXCMD selectp -t 8
$TMUXCMD splitw -h -p 88 'echo "..."'
$TMUXCMD splitw -h -p 85 'echo "..."'
$TMUXCMD splitw -h -p 83 'echo "..."'
$TMUXCMD splitw -h -p 80 'echo "..."'
$TMUXCMD splitw -h -p 75 'echo "..."'
$TMUXCMD splitw -h -p 67 'echo "..."'
$TMUXCMD splitw -h -p 50 'echo "..."'
$TMUXCMD select-layout tiled
fi
# $TMUXCMD new-window -n binaries_threaded 'echo "..."'
# $TMUXCMD splitw -v -p 83 'echo "..."'
@@ -261,7 +265,9 @@ else
$TMUXCMD new-window -n iftop '$IFTOP'
fi
$TMUXCMD new-window -n Console 'bash -i'
if [[ $USE_CONSOLE == "true" ]]; then
$TMUXCMD new-window -n Console 'bash -i'
fi
$TMUXCMD select-window -t$TMUX_SESSION:0
$TMUXCMD attach-session -d -t$TMUX_SESSION