updated optimize scripts

myisam small tables will run after every update_release
inno small tables every 2 hours
all big tables every 24 hours
This commit is contained in:
jonnyboy
2013-01-23 06:24:10 +01:00
parent 1f8528a309
commit 2f756f4ae5
6 changed files with 325 additions and 49 deletions
+46 -35
View File
@@ -63,7 +63,6 @@ $_cleanup = getenv('CLEANUP');
$_optimise = getenv('OPTIMISE');
//$_inno_test = shell_exec('svn info /var/www/newznab | grep inno');
$_innodb_path = getenv('INNODB_PATH');
$_admin_path = getenv('ADMIN_PATH');
$_max_releases = getenv('MAX_RELEASES');
$_import_max_releases = getenv('IMPORT_MAX_RELEASES');
@@ -72,6 +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');
$_mysql = getenv('MYSQL');
$_php = getenv('PHP');
$_nntp = getenv('NNTP_SLEEP');
@@ -98,6 +98,9 @@ $time = TIME();
$time2 = TIME();
$time3 = TIME();
$time4 = TIME();
$time5 = TIME();
$time6 = TIME();
$time7 = TIME();
$i=1;
while($i>0)
@@ -207,93 +210,103 @@ while($i>0)
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 ((TIME() - $time2) >= 900 ) {
shell_exec("tmux respawnp -t $_tmux_session:1.0 'echo \"\033[1;33m\" && cd $_newznab_path && $_php update_predb.php true && date && echo \"$_string\"' 2>&1 1> /dev/null");
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();
}
if (((TIME() - $time3) >= 7200 ) && ($_cleanup == "true" )) {
shell_exec("tmux respawnp -t $_tmux_session:1.1 'echo \"\033[1;34m\" && cd $_testing_path && $_php update_parsing.php && $_php removespecial.php && $_php update_cleanup.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
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();
}
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();
}
if (((TIME() - $time4) >= 43200) || ($i == 1 )) {
shell_exec("tmux respawnp -t $_tmux_session:1.2 'echo \"\033[1;35m\" && cd $_newznab_path && $_php update_tvschedule.php && $_php update_theaters.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
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");
$time6 = TIME();
}
}
//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");
} 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.6 'echo \"\033[1;31m\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");
} else {
shell_exec("tmux respawnp -t $_tmux_session:0.2 'echo \"$_string1\"' 2>&1 1> /dev/null");
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");
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");
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");
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");
} 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.6 'echo \"\033[1;31m\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");
} 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.7 'echo \"\033[1;31m\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");
} 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.8 'echo \"\033[1;31m\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");
} 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.9 '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");
} 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.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.11 'echo \"\033[1;34m\" && cd bin && $_php processOthers.php && date && echo \"$_string\"' 2>&1 1> /dev/null");
if ( $_threads == "true" ) {
$_import_path = $_innodb_path;
$_update_path = $_newznab_path;
$_import_cmd = 'nzb-import.php';
$_backfill_cmd = 'backfill_threaded.php';
$_update_cmd = 'update_binaries_threaded.php';
$_update_path = $_newznab_path;
$_backfill_cmd = 'backfill_threaded.php';
$_update_cmd = 'update_binaries_threaded.php';
} else {
$_import_path = $_innodb_path;
$_update_path = $_newznab_path;
$_import_cmd = 'nzb-import.php';
$_backfill_cmd = 'backfill.php';
$_update_cmd = 'update_binaries.php';
$_update_path = $_newznab_path;
$_backfill_cmd = 'backfill.php';
$_update_cmd = 'update_binaries.php';
}
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");
} 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.12 'echo \"$_string2\"' 2>&1 1> /dev/null");
}
}
if ( $_backfill == "true" ) {
@@ -302,20 +315,18 @@ while($i>0)
$_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.13 '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 $_import_path && $_php $_import_cmd \"$_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.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");
} 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.14 'echo \"$_string2\"' 2>&1 1> /dev/null");
}
}
if (( $_innodb== "true" ) && ( $_optimise == "true" )) {
shell_exec("tmux respawnp -t $_tmux_session:0.15 'echo \"\033[1;36m\" && cd $_newznab_path && $_php update_releases.php && cd $_innodb_path && $_php optimise_myisam.php && $_php optimise_innodb.php && date && echo \"$_sleep_string $_rel_sleep seconds...\" && sleep $_rel_sleep && echo \"$_string\"' 2>&1 1> /dev/null");
} elseif (( $_innodb== "false" ) && ( $_optimise == "true" )) {
shell_exec("tmux respawnp -t $_tmux_session:0.15 'echo \"\033[1;37m\" && cd $_newznab_path && $_php update_releases.php && cd $_innodb_path && $_php optimise_myisam.php && date && echo \"$_sleep_string $_rel_sleep seconds...\" && sleep $_rel_sleep && echo \"$_string\"' 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");
} 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");
}
+143
View File
@@ -0,0 +1,143 @@
<?php
require_once("config.php");
require_once("lib/db.php");
$db = new DB();
$retval = "";
if ($argc == 1) {
echo "no arguments specified - php nzb-import.php /path/to/nzb bool_use_filenames\n";
return;
}
$filestoprocess = Array();
$browserpostednames = Array();
$strTerminator = "\n";
$path = $argv[1];
$usenzbname = (isset($argv[2]) && $argv[2] == 'true') ? true : false;
if (substr($path, strlen($path) - 1) != '/')
$path = $path . "/";
$groups = $db->query("SELECT ID, name FROM groups");
foreach ($groups as $group)
$siteGroups[$group["name"]] = $group["ID"];
if (!isset($groups) || count($groups) == 0) {
echo "no groups available in the database, add first.\n";
} else {
$nzbCount = 0;
if (count($filestoprocess) == 0)
$filestoprocess = glob($path . "*.nzb");
$start = date('Y-m-d H:i:s');
foreach ($filestoprocess as $nzbFile) {
$importfailed = false;
$transaction = "";
$nzb = file_get_contents($nzbFile);
$xml = @simplexml_load_string($nzb);
if (!$xml || strtolower($xml->getName()) != 'nzb') {
continue;
}
$i = 0;
foreach ($xml->file as $file) {
//file info
$groupID = -1;
$name = (string)$file->attributes()->subject;
$fromname = (string)$file->attributes()->poster;
$unixdate = (string)$file->attributes()->date;
$date = date("Y-m-d H:i:s", (string)$file->attributes()->date);
//groups
$groupArr = array();
foreach ($file->groups->group as $group) {
$group = (string)$group;
if (array_key_exists($group, $siteGroups)) {
$groupID = $siteGroups[$group];
}
$groupArr[] = $group;
}
if ($groupID != -1) {
$xref = implode(': ', $groupArr) . ':';
$totalParts = sizeof($file->segments->segment);
//insert binary
$binaryHash = md5($name . $fromname . $groupID);
if ($usenzbname) { //Use the binary names
$usename = str_replace('.nzb', '', basename($nzbFile));
$binarySql = sprintf("INSERT INTO binaries (name, fromname, date, xref, totalParts, groupID, binaryhash, dateadded, importname, relname, relpart, reltotalpart, procstat, categoryID, regexID, reqID) values (%s, %s, %s, %s, %s, %s, %s, NOW(), %s, replace(%s, '_', ' '), %d, %d, %d, %s, %d, %s);",
$db->escapeString($name), $db->escapeString($fromname), $db->escapeString($date),
$db->escapeString($xref), $db->escapeString($totalParts), $db->escapeString($groupID), $db->escapeString($binaryHash), $db->escapeString($nzbFile),
$db->escapeString($usename), 1, 1, 5, "null", "null", "null");
$transaction = $transaction . $binarySql;
} else { //Don't use the binary names
$binarySql = sprintf("INSERT INTO binaries (name, fromname, date, xref, totalParts, groupID, binaryhash, dateadded, importname) values (%s, %s, %s, %s, %s, %s, %s, NOW(), %s);",
$db->escapeString($name), $db->escapeString($fromname), $db->escapeString($date),
$db->escapeString($xref), $db->escapeString($totalParts), $db->escapeString($groupID), $db->escapeString($binaryHash), $db->escapeString($nzbFile));
$transaction = $transaction . $binarySql;
}
$sessionVarSQL = "SET @binID = last_insert_id();";
$transaction = $transaction . $sessionVarSQL;
//segments (i.e. parts)
if (count($file->segments->segment) > 0) {
$partsSql = "INSERT INTO parts (binaryID, messageID, number, partnumber, size, dateadded) values ";
foreach ($file->segments->segment as $segment) {
$messageId = (string)$segment;
$partnumber = $segment->attributes()->number;
$size = $segment->attributes()->bytes;
$partsSql .= sprintf("(%s, %s, 0, %s, %s, NOW()),",
"@binID", $db->escapeString($messageId), $db->escapeString($partnumber),
$db->escapeString($size));
}
$partsSql = substr($partsSql, 0, -1) . ";";
$transaction = $transaction . $partsSql;
}
} else {
$importfailed = true;
echo ("no group found for " . $name . " (one of " . implode(', ', $groupArr) . " are missing)" . $strTerminator);
flush();
break;
}
}
if (!$importfailed) {
$db->multiQueryTransaction($transaction);
$nzbCount++;
@unlink($nzbFile);
echo ("imported " . $nzbFile . $strTerminator);
flush();
}
if ($nzbCount == 100) {
break;
}
}
}
$seconds = strtotime(date('Y-m-d H:i:s')) - strtotime($start);
$retval .= 'Processed ' . $nzbCount . ' nzbs in ' . $seconds . ' second(s)';
echo $retval;
die();
+56
View File
@@ -0,0 +1,56 @@
<?php
require("config.php");
require_once(WWW_DIR . "/lib/framework/cache.php");
require_once(WWW_DIR . "/lib/framework/db.php");
function quantity($force = false)
{
$db = new DB;
$ret = array();
if ($force)
$alltables = $db->query("SELECT table_schema, table_name, data_free/1024/1024 AS data_free_MB FROM information_schema.tables WHERE engine LIKE 'InnoDB' AND data_free < 35*1024*1024");
else
$alltables = $db->query("SELECT table_schema, table_name, data_free/1024/1024 AS data_free_MB FROM information_schema.tables WHERE engine LIKE 'InnoDB' AND data_free != 0*1024*1024 AND data_free < 35*1024*1024");
foreach ($alltables as $tablename)
{
$ret[] = $tablename['table_name'];
}
return $ret;
}
function ioptimise($force = false)
{
$db = new DB;
$ret = array();
if ($force)
$alltables = $db->query("SELECT table_schema, table_name, data_free/1024/1024 AS data_free_MB FROM information_schema.tables WHERE engine LIKE 'InnoDB' AND data_free > 30*1024*1024");
else
$alltables = $db->query("SELECT table_schema, table_name, data_free/1024/1024 AS data_free_MB FROM information_schema.tables WHERE engine LIKE 'InnoDB' AND data_free != 0*1024*1024 AND data_free < 30*1024*1024");
foreach ($alltables as $tablename)
{
$ret[] = $tablename['table_name'];
$db->queryDirect("OPTIMIZE TABLE `" . $tablename['table_name'] . "`");
}
return $ret;
}
$force = ((isset($argv[1]) && ($argv[1] == "true")));
$db = new DB;
echo "\033[1;41;33mOptmze : OPTIMIZATION OF THE MYISAM MYSQL TABLES HAS STARTED, DO NOT STOP THIS SCRIPT!\033[1;33m\n\n";
$qret = quantity($force);
echo "Optmze : Going to start optimizing ".count($qret)." InnoDB tables (if you have InnoDB tables).\n";
$ret = ioptimise($force);
echo "Optmze : Finished optimizing ".count($ret)." InnoDB tables.\n";
if (count($ret) > 0)
{
echo "Optmze : Optimization completed.\033[1;37m\n";
}
else
{
echo "Optmze : Nothing requires optimization.".(!$force ? " Try using force (optimise_inno.php true)" : "")."\033[1;37m\n";
}
+58
View File
@@ -0,0 +1,58 @@
<?php
require("config.php");
require_once(WWW_DIR . "/lib/framework/cache.php");
require_once(WWW_DIR . "/lib/framework/db.php");
function quantity($force = false)
{
$db = new DB;
$ret = array();
if ($force)
$alltables = $db->query("show table status where `Engine` = 'MyISAM' and Data_free > 30000000");
else
$alltables = $db->query("show table status where `Engine` = 'MyISAM' and Data_free != 0 and Data_free < 30000001");
foreach ($alltables as $tablename)
{
$ret[] = $tablename['Name'];
}
return $ret;
}
function moptimise($force = false)
{
$db = new DB;
$ret = array();
if ($force)
$alltables = $db->query("show table status where `Engine` = 'MyISAM' and Data_free > 30000000");
else
$alltables = $db->query("show table status where `Engine` = 'MyISAM' and Data_free != 0 and Data_free < 30000001");
foreach ($alltables as $tablename)
{
$ret[] = $tablename['Name'];
$db->queryDirect("REPAIR TABLE `" . $tablename['Name'] . "`");
$db->queryDirect("OPTIMIZE TABLE `" . $tablename['Name'] . "`");
$db->queryDirect("ANALYZE TABLE `" . $tablename['Name'] . "`");
}
return $ret;
}
$force = ((isset($argv[1]) && ($argv[1] == "true")));
$db = new DB;
echo "\033[1;41;33mOptmze : OPTIMIZATION OF THE MYISAM MYSQL TABLES HAS STARTED, DO NOT STOP THIS SCRIPT!\033[1;0;33m\n\n";
$qret = quantity($force);
echo "Optmze : Going to start optimizing ".count($qret)." MyISAM tables (if you have MyISAM tables).\n";
$ret = moptimise($force);
echo "Optmze : Finished optimizing ".count($ret)." MyISAM tables.\n";
if (count($ret) > 0)
{
echo "Optmze : Optimization completed.\033[1;37m\n";
}
else
{
echo "Optmze : Nothing requires optimization.".(!$force ? " Try using force (optimise_myisam.php true)" : "")."\033[1;37m\n";
}
+17 -12
View File
@@ -8,7 +8,7 @@ export NEWZPATH="/var/www/newznab"
export NEWZNAB_PATH=$NEWZPATH"/misc/update_scripts"
export TESTING_PATH=$NEWZPATH"/misc/testing"
export ADMIN_PATH=$NEWZPATH"/www/admin"
export INNODB_PATH=$DIR"/bin/innodb"
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
@@ -17,26 +17,26 @@ export INNODB_PATH=$DIR"/bin/innodb"
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"
#Set, in seconds - how long the update_binaries should sleep between runs, 0 may cause errors
#top right pane
export NNTP_SLEEP="20"
export NNTP_SLEEP="40"
#Set, in seconds - how long the backfill should sleep between runs, 0 may cause errors
#below update_binaries
export BACKFILL_SLEEP="20"
export BACKFILL_SLEEP="40"
#Set, in seconds - how long the nzb-import should sleep between runs, 0 may cause errors
#below backfill
export IMPORT_SLEEP="20"
export IMPORT_SLEEP="40"
#Set, in seconds - how long the update_release should sleep between runs, 0 may cause errors
#bottom right
export RELEASES_SLEEP="20"
export RELEASES_SLEEP="40"
#Set the maximum days to backfill, you set the nn+ admin/edit backfill to 1
#this will increment your database by 1 after each backfill loop
@@ -46,7 +46,7 @@ export MAXDAYS="210"
#Set the path to the nzb dump you downloaded from torrents, theis is the path to bulk files folder of nzbs
#this does not recurse through subfolders
export NZBS="/path/to/nzbs"
export NZBS="/home/jonnyboy/nzbs/batch"
#Choose to run the threaded or non-threaded newznab scripts true/false
#such as update_binaries.php or update_binaries_threaded.php
@@ -54,13 +54,18 @@ export THREADS="true"
#Choose your database engine, comment the one true/false
#you should have already converted your database to InnoDB engine, if you select true here
export INNODB="true"
export INNODB="false"
#Choose to run update_cleanup.php true/false
#set to false by default, you will need to edit /misc/testing/update_cleanup.php and /misc/testing/update_parsing.php
#Choose to run update_cleanup.php and removespecial.php true/false
#set to false by default, you will need to edit /misc/testing/update_cleanup.php and /misc/testing/removespecial.php
#to actually do anything, directions are in the file
export CLEANUP="false"
#Choose to run update_parsing.php true/false
#set to false by default, you will need to edit /misc/testing/removespecial.php
#to actually do anything, directions are in the file
export PARSING="true"
#Choose to run update_binaries true/false
export BINARIES="true"
@@ -101,11 +106,11 @@ export USE_VNSTAT="false"
#Each pane may have periods of inactivity, at the time "Pane is Dead" will be displayed.
#To disable my notes about why this is ok, change to false
export SHOW_WHY="true"
export SHOW_WHY="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"
export AGREED="yes"
##END OF EDITS##
+5 -2
View File
@@ -25,7 +25,7 @@ fi
#echo $NEWZPATH/lib
#remove postprocessing scripts
rm -f bin/lib/*
rm -f bin/lib/post*
#create postprocessing scripts
cp $NEWZPATH/www/lib/postprocess.php bin/lib/postprocess2.php
@@ -66,7 +66,7 @@ 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'
$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 selectp -t 0
$TMUX splitw -h -p 72 'echo "..."'
$TMUX splitw -h -p 50 'echo "..."'
@@ -88,11 +88,14 @@ $TMUX splitw -v -p 67 'echo "..."'
$TMUX splitw -v -p 50 'echo "..."'
$TMUX new-window -n cleanup 'echo "..."'
$TMUX selectp -t 0
$TMUX splitw -h -p 67 'echo "..."'
$TMUX splitw -h -p 50 'echo "..."'
$TMUX selectp -t 0
$TMUX splitw -v -p 50 'echo "..."'
$TMUX selectp -t 2
$TMUX splitw -v -p 50 'echo "..."'
$TMUX selectp -t 4
$TMUX splitw -v -p 50 'echo "..."'
if [[ $USE_HTOP == "true" ]]; then
$TMUX new-window -n htop '$HTOP'