From acb5d894426a7ff4ba6c126bcc728d080d249c4b Mon Sep 17 00:00:00 2001 From: jonnyboy Date: Sat, 6 Apr 2013 13:11:24 -0400 Subject: [PATCH] added file to validate(partially) the strings for variables, moved some files to temp locations, move some files to bin/scripts --- bin/lib/additional | 4 +- bin/monitor.php | 8 +- bin/postprocess_nfo.php | 4 +- bin/postprocess_nfo1.php | 4 +- bin/preflight.sh | 275 ------------------------------- bin/processBooks1.php | 2 +- bin/processGames1.php | 2 +- bin/processMovies1.php | 2 +- bin/processMusic.php | 2 +- bin/processMusic1.php | 2 +- bin/processTv3.php | 4 +- bin/scripts/check_vars.sh | 76 +++++++++ bin/scripts/preflight.sh | 311 ++++++++++++++++++++++++++++++++++++ bin/scripts/regex.txt | 1 + bin/temp/.gitignore | 1 + conf/jonnyboys_defaults.sh | 86 +++++----- scripts/fix_files.sh | 30 ++-- scripts/reset_rar_check.php | 9 ++ start.sh | 25 +-- 19 files changed, 489 insertions(+), 359 deletions(-) delete mode 100755 bin/preflight.sh create mode 100755 bin/scripts/check_vars.sh create mode 100755 bin/scripts/preflight.sh create mode 100644 bin/scripts/regex.txt create mode 100644 bin/temp/.gitignore create mode 100755 scripts/reset_rar_check.php diff --git a/bin/lib/additional b/bin/lib/additional index dc5637a80..1d39331c6 100644 --- a/bin/lib/additional +++ b/bin/lib/additional @@ -1,7 +1,7 @@ processAdditional1(); diff --git a/bin/monitor.php b/bin/monitor.php index d44b9cc7c..33256b59c 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -2,7 +2,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); -$version="0.1r774"; +$version="0.1r775"; $db = new DB(); @@ -51,6 +51,8 @@ $_conf = dirname(__FILE__)."/../conf"; $_powerline = dirname(__FILE__)."/../powerline"; $_cj = dirname(__FILE__)."/../nnscripts"; $_user = dirname(__FILE__)."/../user_scripts"; +$_temp = dirname(__FILE__)."/../bin/temp"; + $NNPATH="{$array['NEWZPATH']}{$array['NEWZNAB_PATH']}"; $TESTING="{$array['NEWZPATH']}{$array['TESTING_PATH']}"; $killed="false"; @@ -1059,7 +1061,7 @@ while( $i > 0 ) $color = get_color(); $log = writelog($panes2[$h]); if (( $array['MAX_LOAD'] >= get_load()) && ( $array['POST_TO_RUN_A'] >= $g ) && ( $work_remaining_now > $f ) && ( $optimize_safe_to_run != "true" )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes2[$h] $ds2 && cd $_bin && $_php processAdditional$g.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes2[$h] $ds3' 2>&1 1> /dev/null"); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes2[$h] $ds2 && cd $_temp && $_php processAdditional$g.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes2[$h] $ds3' 2>&1 1> /dev/null"); } elseif (( $array['POST_TO_RUN_A'] >= $g ) && ( $work_remaining_now <= $f ) && ( $optimize_safe_to_run != "true" )) { shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\n$panes2[$h] $work_remaining_now < $f\nHas no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $g > $post ) && ( $optimize_safe_to_run != "true" )) { @@ -1082,7 +1084,7 @@ while( $i > 0 ) $color = get_color(); $log = writelog($panes2[$h]); if (( $array['MAX_LOAD'] >= get_load()) && ( $array['POST_TO_RUN_B'] >= $g ) && ( $work_remaining_now > $f ) && ( $optimize_safe_to_run != "true" )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:3.$h 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes3[$h] $ds2 && cd $_bin && $_php processAdditional$k.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes3[$h] $ds3' 2>&1 1> /dev/null"); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:3.$h 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes3[$h] $ds2 && cd $_temp && $_php processAdditional$k.php 2>&1 $log && echo \" \033[1;0;33m\" && $ds1 $panes3[$h] $ds3' 2>&1 1> /dev/null"); } elseif (( $array['POST_TO_RUN_B'] >= $g ) && ( $work_remaining_now <= $f ) && ( $optimize_safe_to_run != "true" )) { shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:3.$h 'echo \"\033[38;5;\"$color\"m\n$panes3[$h]\n$work_remaining_now < $f\nHas no work to process \" && date +\"%D %T\" && echo \"This is color #$color\"' 2>&1 1> /dev/null"); } elseif (( $g > $post ) && ( $optimize_safe_to_run != "true" )) { diff --git a/bin/postprocess_nfo.php b/bin/postprocess_nfo.php index 88bf05260..fa0021354 100644 --- a/bin/postprocess_nfo.php +++ b/bin/postprocess_nfo.php @@ -1,7 +1,7 @@ processNfos(); diff --git a/bin/postprocess_nfo1.php b/bin/postprocess_nfo1.php index a8e56e1ff..63dd32012 100644 --- a/bin/postprocess_nfo1.php +++ b/bin/postprocess_nfo1.php @@ -1,7 +1,7 @@ processNfos1(); diff --git a/bin/preflight.sh b/bin/preflight.sh deleted file mode 100755 index ff31cd6e6..000000000 --- a/bin/preflight.sh +++ /dev/null @@ -1,275 +0,0 @@ -#!/usr/bin/env bash -SOURCE="${BASH_SOURCE[0]}" -DIR="$( dirname "$SOURCE" )" -while [ -h "$SOURCE" ] -do - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -done -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - -if [ ! -f defaults.sh ]; then - clear - echo "Please copy config.sh to defaults.sh" - exit -fi - -source config.sh -source defaults.sh - -eval $( $SED -n "/^define/ { s/.*('\([^']*\)', '*\([^']*\)'*);/export \1=\"\2\"/; p }" "$NEWZPATH"/www/config.php ) - - if [ -f user_scripts/$USER_DEF_ONE ]; then - cd user_scripts && ./$USER_DEF_ONE - cd ../ - fi - - if [ ! -f $NEWZPATH/www/lib/postprocess.php.orig ]; then - cp $NEWZPATH/www/lib/postprocess.php $NEWZPATH/www/lib/postprocess.php.orig - fi - if ! grep -q '//$this->processAdditional();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processAdditional();/\/\/$this->processAdditional();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processNfos();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processNfos();/\/\/$this->processNfos();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processSpotNab();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processSpotNab();/\/\/$this->processSpotNab();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processUnwanted();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processUnwanted();/\/\/$this->processUnwanted();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processMovies();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processMovies();/\/\/$this->processMovies();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processMusic();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processMusic();/\/\/$this->processMusic();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processBooks();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processBooks();/\/\/$this->processBooks();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processGames();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processGames();/\/\/$this->processGames();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processTv();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processTv();/\/\/$this->processTv();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processMusicFromMediaInfo();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processMusicFromMediaInfo();/\/\/$this->processMusicFromMediaInfo();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processOtherMiscCategory();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processOtherMiscCategory();/\/\/$this->processOtherMiscCategory();/' $NEWZPATH/www/lib/postprocess.php - fi - if ! grep -q '//$this->processUnknownCategory();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processUnknownCategory();/\/\/$this->processUnknownCategory();/' $NEWZPATH/www/lib/postprocess.php - fi - - #create mysql my.conf - #this keeps your password from being displayed in ps, htop and others - echo "[client]" > ./conf/my.cnf - echo "password=$DB_PASSWORD" >> ./conf/my.cnf - chmod 600 ./conf/my.cnf - - #create powerline tmux.sh - if [ ! -f "powerline/powerline/themes/tmux.sh" ]; then - cp powerline/powerline/themes/default.sh powerline/powerline/themes/tmux.sh - fi - - #Get the path to tmpunrar - TMPUNRAR_QUERY="SELECT value from site where setting = \"tmpunrarpath\";" - TMPUNRAR_PATH=`$MYSQL --defaults-file=conf/my.cnf -u$DB_USER -h$DB_HOST $DB_NAME -s -N -e "${TMPUNRAR_QUERY}"` - TMPUNRAR_PATH=$TMPUNRAR_PATH"1" - - if [ ! -d "$TMPUNRAR_PATH" ]; then - mkdir -p $TMPUNRAR_PATH - fi - - #determine if ramdisk is in fstab - if [[ $RAMDISK == "true" ]]; then - if [[ `grep "$TMPUNRAR_PATH" /etc/fstab` ]]; then - if [[ ! `mount | grep "$TMPUNRAR_PATH"` ]]; then - mount "$TMPUNRAR_PATH" - fi - fi - elif [[ $RAMDISK == "true" ]]; then - if [[ ! `mount | grep "$TMPUNRAR_PATH"` ]]; then - mount -t tmpfs -o size=256M tmpfs $TMPUNRAR_PATH - fi - fi - - #remove postprocessing scripts - rm -f bin/lib/post* - rm -f bin/lib/book.php - rm -f bin/lib/console.php - rm -f bin/lib/movie.php - rm -f bin/lib/music.php - rm -f bin/lib/music1.php - rm -f bin/lib/nfo.php - rm -f bin/lib/tvrage.php - rm -f bin/processAdditional* - rm -f bin/processAlternate* - rm -f bin/lib/nntp2.php - - #create postprocessing scripts - for (( c=2; c<=16; 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/echo \$iteration.*$/echo \$iteration --.\" \".\$rel['ID'].\" : \".\$rel['name'].\"\\\n\";/" 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 .= '1\/tmp$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 * 100, \$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 ...\\n\";/g" bin/lib/postprocess$c.php - $SED -i -e "s/\/\/echo \"PostPrc : Fetching/echo \"PostPrc : Fetching/g" bin/lib/postprocess$c.php - if [[ $USE_TWO_NNTP == "true" ]] && [[ $USE_TWO_PP != "true" ]]; then - $SED -i -e "s/require_once(WWW_DIR.\"\/lib\/nntp.php\");/require(dirname(__FILE__).\"\/nntp2.php\");/g" bin/lib/postprocess$c.php - $SED -i -e "s/new Nntp;/new GetConnected;/g" bin/lib/postprocess$c.php - $SED -i -e "s/doConnect/doConnect2/g" bin/lib/postprocess$c.php - fi - - cp bin/lib/additional bin/processAdditional$c.php - $SED -i -e "s/1/$c/g" bin/processAdditional$c.php - $SED -i -e "s/$numtoProcess = 100;/$numtoProcess = 20;/g" bin/lib/postprocess$c.php - done - - for (( c=17; c<=32; 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/echo \$iteration.*$/echo \$iteration --.\" \".\$rel['ID'].\" : \".\$rel['name'].\"\\\n\";/" 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 .= '1\/tmp$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 + 16) * 100, \$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 ...\\n\";/g" bin/lib/postprocess$c.php - $SED -i -e "s/\/\/echo \"PostPrc : Fetching/echo \"PostPrc : Fetching/g" bin/lib/postprocess$c.php - if [[ $USE_TWO_NNTP == "true" ]] && [[ $USE_TWO_PP == "true" ]]; then - $SED -i -e "s/require_once(WWW_DIR.\"\/lib\/nntp.php\");/require(dirname(__FILE__).\"\/nntp2.php\");/g" bin/lib/postprocess$c.php - $SED -i -e "s/new Nntp;/new GetConnected;/g" bin/lib/postprocess$c.php - $SED -i -e "s/doConnect/doConnect2/g" bin/lib/postprocess$c.php - fi - - cp bin/lib/additional bin/processAdditional$c.php - $SED -i -e "s/1/$c/g" bin/processAdditional$c.php - $SED -i -e "s/$numtoProcess = 100;/$numtoProcess = 20;/g" bin/lib/postprocess$c.php - done - - cp $NEWZPATH/www/lib/postprocess.php bin/lib/postprocess1.php - cp bin/lib/additional bin/processAdditional1.php - - #edit postprocessing scripts - $SED -i -e 's/PostProcess/PostProcess1/g' bin/lib/postprocess1.php - $SED -i -e "s/echo \$iteration.*$/echo \$iteration --.\" \".\$rel['ID'].\" : \".\$rel['name'].\"\\\n\";/" 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 .= '1\/tmp1';/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 ...\\n";/g' bin/lib/postprocess1.php - $SED -i -e "s/\/\/echo \"PostPrc : Fetching/echo \"PostPrc : Fetching/g" bin/lib/postprocess1.php - $SED -i -e "s/$numtoProcess = 100;/$numtoProcess = 20;/g" bin/lib/postprocess1.php - if [[ $USE_TWO_NNTP == "true" ]] && [[ $USE_TWO_PP != "true" ]]; then - $SED -i -e "s/require_once(WWW_DIR.\"\/lib\/nntp.php\");/require(dirname(__FILE__).\"\/nntp2.php\");/g" bin/lib/postprocess1.php - $SED -i -e "s/new Nntp;/new GetConnected;/g" bin/lib/postprocess1.php - $SED -i -e "s/doConnect/doConnect2/g" bin/lib/postprocess1.php - fi - - - cp -f $NEWZPATH/www/lib/nfo.php bin/lib/nfo.php - #cp -f $NEWZPATH/www/lib/tvrage.php bin/lib/tvrage.php - cp -f $NEWZPATH/www/lib/movie.php bin/lib/movie.php - cp -f $NEWZPATH/www/lib/music.php bin/lib/music.php - cp -f $NEWZPATH/www/lib/music.php bin/lib/music1.php - cp -f $NEWZPATH/www/lib/console.php bin/lib/console.php - cp -f $NEWZPATH/www/lib/book.php bin/lib/book.php - cp -f $NEWZPATH/www/lib/nntp.php bin/lib/nntp2.php - - - $SED -i -e "s/function doConnect/function doConnect2/" bin/lib/nntp2.php - $SED -i -e "s/NNTP_USERNAME/NNTP_USERNAME2/g" bin/lib/nntp2.php - $SED -i -e "s/NNTP_PASSWORD/NNTP_PASSWORD2/g" bin/lib/nntp2.php - $SED -i -e "s/NNTP_SERVER/NNTP_SERVER2/g" bin/lib/nntp2.php - $SED -i -e "s/NNTP_PORT/NNTP_PORT2/g" bin/lib/nntp2.php - $SED -i -e "s/NNTP_SSLENABLED/NNTP_SSLENABLED2/g" bin/lib/nntp2.php - $SED -i -e "s/NNTPException/NNTPException2/g" bin/lib/nntp2.php - $SED -i -e "s/class Nntp/class GetConnected/g" bin/lib/nntp2.php - - $SED -i -e "s/500/250/" bin/lib/postprocess1.php - $SED -i -e "s/500/250/" bin/lib/postprocess2.php - - $SED -i -e "s/class Nfo/class Nfo1/" bin/lib/nfo.php - #$SED -i -e "s/class TvRage/class TvRage1/" bin/lib/tvrage.php - $SED -i -e "s/class Movie/class Movie1/" bin/lib/movie.php - $SED -i -e "s/class Music/class Music1/" bin/lib/music.php - $SED -i -e "s/class Music/class Music2/" bin/lib/music1.php - $SED -i -e "s/class Console/class Console1/" bin/lib/console.php - $SED -i -e "s/class Book/class Book1/" bin/lib/book.php - - $SED -i -e "s/function Nfo/function Nfo1/" bin/lib/nfo.php - #$SED -i -e "s/function TvRage/function TvRage1/" bin/lib/tvrage.php - $SED -i -e "s/function Movie/function Movie1/" bin/lib/movie.php - $SED -i -e "s/function Music/function Music1/" bin/lib/music.php - $SED -i -e "s/function Music/function Music2/" bin/lib/music1.php - $SED -i -e "s/function Console/function Console1/" bin/lib/console.php - $SED -i -e "s/function Book/function Book1/" bin/lib/book.php - - $SED -i -e "s/processNfoFiles/processNfoFiles1/" bin/lib/nfo.php - $SED -i -e "s/processMovieReleases/processMovieReleases1/" bin/lib/movie.php - $SED -i -e "s/processMusicReleases/processMusicReleases1/" bin/lib/music.php - $SED -i -e "s/processMusicReleases/processMusicReleases2/" bin/lib/music1.php - $SED -i -e "s/processBookReleases/processBookReleases1/" bin/lib/book.php - $SED -i -e "s/processConsoleReleases/processConsoleReleases1/" bin/lib/console.php - - $SED -i -e "s/nfoHandleError/nfoHandleError1/" bin/lib/nfo.php - $SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" bin/lib/nfo.php - - $SED -i -e 's/WWW_DIR."\/lib\/nfo.php"/"nfo.php"/g' bin/lib/postprocess2.php - $SED -i -e 's/WWW_DIR."\/lib\/movie.php"/"movie.php"/g' bin/lib/postprocess2.php - $SED -i -e 's/WWW_DIR."\/lib\/music.php"/"music.php"/g' bin/lib/postprocess1.php - $SED -i -e 's/WWW_DIR."\/lib\/music.php"/"music1.php"/g' bin/lib/postprocess2.php - $SED -i -e 's/WWW_DIR."\/lib\/console.php"/"console.php"/g' bin/lib/postprocess2.php - $SED -i -e 's/WWW_DIR."\/lib\/book.php"/"book.php"/g' bin/lib/postprocess2.php - #$SED -i -e 's/WWW_DIR."\/lib\/tvrage.php"/"tvrage.php"/g' bin/lib/postprocess2.php - - $SED -i -e "s/processNfos()/processNfos1()/g" bin/lib/postprocess2.php - $SED -i -e "s/processMovies()/processMovies1()/g" bin/lib/postprocess2.php - $SED -i -e "s/processMusic()/processMusic1()/g" bin/lib/postprocess1.php - $SED -i -e "s/processMusic()/processMusic2()/g" bin/lib/postprocess2.php - $SED -i -e "s/processBooks()/processBooks1()/g" bin/lib/postprocess2.php - $SED -i -e "s/processGames()/processGames1()/g" bin/lib/postprocess2.php - $SED -i -e "s/processTv()/processTv1()/g" bin/lib/postprocess2.php - - $SED -i -e "s/new Nfo/new Nfo1/" bin/lib/postprocess2.php - $SED -i -e "s/new Movie/new Movie1/" bin/lib/postprocess2.php - $SED -i -e "s/new Music/new Music1/" bin/lib/postprocess1.php - $SED -i -e "s/new Music/new Music2/" bin/lib/postprocess2.php - $SED -i -e "s/new Book/new Book1/" bin/lib/postprocess2.php - $SED -i -e "s/new Console/new Console1/" bin/lib/postprocess2.php - - $SED -i -e "s/processNfoFiles/processNfoFiles1/" bin/lib/postprocess2.php - $SED -i -e "s/processMovieReleases()/processMovieReleases1()/" bin/lib/postprocess2.php - $SED -i -e "s/processMusicReleases()/processMusicReleases1()/" bin/lib/postprocess1.php - $SED -i -e "s/processMusicReleases()/processMusicReleases2()/" bin/lib/postprocess2.php - $SED -i -e "s/processBookReleases()/processBookReleases1()/" bin/lib/postprocess2.php - $SED -i -e "s/processConsoleReleases()/processConsoleReleases1()/" bin/lib/postprocess2.php - - $SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" bin/lib/nfo.php - $SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" bin/lib/movie.php - $SED -i -e "s/ORDER BY createddate DESC/ORDER BY createddate ASC/" bin/lib/movie.php - $SED -i -e "s/ORDER BY postdate DESC LIMIT 1000/ORDER BY postdate DESC LIMIT 100/" bin/lib/music.php - $SED -i -e "s/ORDER BY postdate DESC LIMIT 1000/ORDER BY postdate ASC LIMIT 100/" bin/lib/music1.php - $SED -i -e "s/ORDER BY createddate DESC/ORDER BY createddate DESC/" bin/lib/music.php - $SED -i -e "s/ORDER BY createddate DESC/ORDER BY createddate ASC/" bin/lib/music1.php - $SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" bin/lib/book.php - $SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" bin/lib/console.php - $SED -i -e "s/ORDER BY createddate DESC/ORDER BY createddate ASC/" bin/lib/console.php - -# $SED -i -e "s/order by postdate desc/ORDER BY postdate ASC/" bin/lib/tvrage.php -# $SED -i -e "s/order by rageID asc/order by rageID DESC/" bin/lib/tvrage.php -# $SED -i -e "s/order by airdate asc/order by airdate DESC/" bin/lib/tvrage.php -# $SED -i -e "s/order by tvrage.releasetitle asc/order by tvrage.releasetitle DESC/" bin/lib/tvrage.php - - diff --git a/bin/processBooks1.php b/bin/processBooks1.php index 5eeba40b9..006fdcb49 100644 --- a/bin/processBooks1.php +++ b/bin/processBooks1.php @@ -1,7 +1,7 @@ processBooks1(); diff --git a/bin/processGames1.php b/bin/processGames1.php index 05065a287..ff1ce48d2 100644 --- a/bin/processGames1.php +++ b/bin/processGames1.php @@ -1,7 +1,7 @@ processGames1(); diff --git a/bin/processMovies1.php b/bin/processMovies1.php index 8c2d322b2..c95072ba4 100644 --- a/bin/processMovies1.php +++ b/bin/processMovies1.php @@ -1,7 +1,7 @@ processMovies1(); diff --git a/bin/processMusic.php b/bin/processMusic.php index 1685696cf..8bba3b3ec 100644 --- a/bin/processMusic.php +++ b/bin/processMusic.php @@ -1,7 +1,7 @@ processMusic1(); diff --git a/bin/processMusic1.php b/bin/processMusic1.php index f9c5be7d8..54543223f 100644 --- a/bin/processMusic1.php +++ b/bin/processMusic1.php @@ -1,7 +1,7 @@ processMusic2(); diff --git a/bin/processTv3.php b/bin/processTv3.php index 6e0504749..621265897 100644 --- a/bin/processTv3.php +++ b/bin/processTv3.php @@ -1,8 +1,8 @@ get(); diff --git a/bin/scripts/check_vars.sh b/bin/scripts/check_vars.sh new file mode 100755 index 000000000..4233846e2 --- /dev/null +++ b/bin/scripts/check_vars.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +SOURCE="${BASH_SOURCE[0]}" +DIR="$( dirname "$SOURCE" )" +while [ -h "$SOURCE" ] +do + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +source defaults.sh + +echo -e "\033[38;5;160m" +for vars in RUNNING USE_TWO_NNTP USE_TWO_PP NFOS GAMES MOVIES MUSIC TVRAGE EBOOK OTHERS UNWANTED KEEP_KILLED SEQUENTIAL BINARIES BINARIES_THREADS BACKFILL BACKFILL_THREADS KEVIN_SAFER KEVIN_BACKFILL_PARTS KEVIN_THREADED IMPORT NZB_THREADS IMPORT_TRUE MISC_ONLY RELEASES OPTIMIZE OPTIMIZE_KILL INNODB CLEANUP CLEANUP_EDIT PARSING PARSING_MOD FIX_DROID PAST_24_HOURS PREDB SPOTNAB SPOTNAB_ACTIVE TV_SCHEDULE SPHINX KILL_QUIET DELETE_PARTS FIX_POSIX USE_HTOP USE_BWMNG USE_MYTOP USE_ATOP USE_NMON USE_IOTOP USE_VNSTAT USE_TCPTRACK USE_TOP USE_IFTOP USE_CONSOLE POWERLINE EN_IMDB RAMDISK CHOWN_TRUE WRITE_LOGS +do + #echo $vars=\"${!vars}\" + if [[ ${!vars} != "true" ]] && [[ ${!vars} != "false" ]]; then + clear + echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + fi +done + +if ! [[ $NICENESS -le 19 && $NICENESS -ge -20 ]]; then + clear + echo -e "NICENESS=$NICENESS is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 +fi + +for vars in MAX_LOAD MAX_LOAD_RELEASES MONITOR_UPDATE KILL_UPDATES BINARIES_SEQ_TIMER BINARIES_SLEEP BINARIES_MAX_RELEASES BINARIES_MAX_BINS BINARIES_MAX_ROWS BACKFILL_SLEEP BACKFILL_MAX_RELEASES BACKFILL_MAX_BINS BACKFILL_MAX_ROWS MAXDAYS KEVIN_PARTS NZB_FOLDER_COUNT NZBCOUNT IMPORT_SLEEP IMPORT_MAX_RELEASES IMPORT_MAX_ROWS RELEASES_SLEEP MYISAM_SMALL MYISAM_LARGE INNODB_SMALL INNODB_LARGE CLEANUP_TIMER PARSING_TIMER PREDB_TIMER SPOTNAB_TIMER TVRAGE_TIMER SPHINX_TIMER KILL_PROCESS DELETE_TIMER +do + if ! [[ ${!vars} =~ ^[0-9]+([.][0-9]+)?$ ]]; then + clear + echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + fi +done + +for vars in POST_TO_RUN_A POST_TO_RUN_B +do + if ! [[ ${!vars} -le 16 && ${!vars} -ge 0 ]]; then + clear + echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + fi +done + +for vars in NEWZPATH NEWZNAB_PATH TESTING_PATH ADMIN_PATH NZBS RAMDISK_PATH +do + if [ ! -d ${!vars} ]; then + clear + echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + fi +done + +for vars in KEVIN_DATE +do + if ! [[ ${!vars} =~ ^2[0-1][0-9][0-9]-[0-1][0-9]-[0-3][0-9] ]]; then + clear + echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + fi +done + +for vars in SED USER_DEF_ONE USER_DEF_TWO USER_DEF_THREE USER_DEF_FOUR USER_DEF_FIVE +do + if [ ! -f ${!vars} ]; then + clear + echo -e "$vars=\"${!vars}\" is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + fi +done + +if [[ $NEWZDASH_URL ]]; then + wget NEWZDASH_URL >/dev/null 2>&1 + if ! [[ $? == 0 ]]; then + echo -e "NEWZDASH_URL=$NEWZDASH_URL is not valid. Please edit defaults.sh and correct it. Aborting.\n"; exit 1 + fi +fi + +echo -e "\033[0m" diff --git a/bin/scripts/preflight.sh b/bin/scripts/preflight.sh new file mode 100755 index 000000000..019bb7272 --- /dev/null +++ b/bin/scripts/preflight.sh @@ -0,0 +1,311 @@ +#!/usr/bin/env bash +SOURCE="${BASH_SOURCE[0]}" +DIR="$( dirname "$SOURCE" )" +while [ -h "$SOURCE" ] +do + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +if [ ! -f defaults.sh ]; then + clear + echo "Please copy config.sh to defaults.sh" + exit 1 +fi + +source config.sh +source defaults.sh + +eval $( $SED -n "/^define/ { s/.*('\([^']*\)', '*\([^']*\)'*);/export \1=\"\2\"/; p }" "$NEWZPATH"/www/config.php ) + +if [ -f user_scripts/$USER_DEF_ONE ]; then + cd $DIR/user_scripts && ./$USER_DEF_ONE + cd $DIR +fi + +if [ ! -f $NEWZPATH/www/lib/postprocess.php.orig ]; then + cp $NEWZPATH/www/lib/postprocess.php $NEWZPATH/www/lib/postprocess.php.orig +fi + +if ! grep -q '//$this->processAdditional();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processAdditional();/\/\/$this->processAdditional();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processNfos();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processNfos();/\/\/$this->processNfos();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processSpotNab();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processSpotNab();/\/\/$this->processSpotNab();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processUnwanted();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processUnwanted();/\/\/$this->processUnwanted();/' $NEWZPATH/www/lib/postprocess.php + +fi + +if ! grep -q '//$this->processMovies();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processMovies();/\/\/$this->processMovies();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processMusic();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processMusic();/\/\/$this->processMusic();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processBooks();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processBooks();/\/\/$this->processBooks();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processGames();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processGames();/\/\/$this->processGames();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processTv();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processTv();/\/\/$this->processTv();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processMusicFromMediaInfo();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processMusicFromMediaInfo();/\/\/$this->processMusicFromMediaInfo();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processOtherMiscCategory();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processOtherMiscCategory();/\/\/$this->processOtherMiscCategory();/' $NEWZPATH/www/lib/postprocess.php +fi + +if ! grep -q '//$this->processUnknownCategory();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processUnknownCategory();/\/\/$this->processUnknownCategory();/' $NEWZPATH/www/lib/postprocess.php +fi + +#if ! grep -q '//$this->rarfileregex = ' "$NEWZPATH/www/lib/nzbinfo.php" ; then + #$SED -i -e 's/$this->rarfileregex =.*$/\/\/$this->rarfileregex =$1/' $NEWZPATH/www/lib/nzbinfo.php +#fi + +#edit cleanup scripts +if [[ $CLEANUP_EDIT == "true" ]]; then + $SED -i -e 's/^$echo =.*$/$echo = false;/' $TESTING_PATH/update_parsing.php + $SED -i -e 's/^$limited =.*$/$limited = false;/' $TESTING_PATH/update_parsing.php + $SED -i -e 's/^$echo =.*$/$echo = false;/' $TESTING_PATH/update_cleanup.php + $SED -i -e 's/^$limited =.*$/$limited = false;/' $TESTING_PATH/update_cleanup.php +fi + +#edit powerprocess.php +if [[ $FIX_POSIX == "true" ]]; then + $SED -i -e 's/case SIGSTKFLT:/\/\/case SIGSTKFLT:/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/return 'SIGSTKFLT';/\/\/return 'SIGSTKFLT';/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/case SIGCLD:/\/\/case SIGCLD:/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/return 'SIGCLD';/\/\/return 'SIGCLD';/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/case SIGPOLL:/\/\/case SIGPOLL:/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/return 'SIGPOLL';/\/\/return 'SIGPOLL';/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/case SIGPWR:/\/\/case SIGPWR:/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/return 'SIGPWR';/\/\/return 'SIGPWR';/' $NEWZPATH/www/lib/powerprocess.php +fi + +#attempt to get english only from IMDB +if [[ $EN_IMDB == "true" ]]; then + $SED -i -e 's/akas.imdb/www.imdb/g' $NEWZPATH/www/lib/movie.php + $SED -i -e 's/akas.imdb/www.imdb/g' $TESTING_PATH/update_parsing.php + $SED -i -e 's/curl_setopt($ch, CURLOPT_URL, $url);/curl_setopt($ch, CURLOPT_URL, $url);\ + $header[] = "Accept-Language: en-us";\ + curl_setopt($ch, CURLOPT_HTTPHEADER, $header);/' $NEWZPATH/www/lib/util.php +fi + +#import kevin123's compression mod +if [[ $KEVIN_SAFER == "true" ]] || [[ $PARSING_MOD == "true" ]]; then + cd $DIR"/kevin123" + cp -fr * $NEWZPATH/www/lib/ + cd $DIR +fi + +#create mysql my.conf +#this keeps your password from being displayed in ps, htop and others +echo "[client]" > $DIR/conf/my.cnf +echo "password=$DB_PASSWORD" >> $DIR/conf/my.cnf +chmod 600 $DIR/conf/my.cnf + +#create powerline tmux.sh +if [ ! -f "$DIR/powerline/powerline/themes/tmux.sh" ]; then + cp $DIR/powerline/powerline/themes/default.sh powerline/powerline/themes/tmux.sh +fi + +#Get the path to tmpunrar +TMPUNRAR_QUERY="SELECT value from site where setting = \"tmpunrarpath\";" +TMPUNRAR_PATH=`$MYSQL --defaults-file=conf/my.cnf -u$DB_USER -h$DB_HOST $DB_NAME -s -N -e "${TMPUNRAR_QUERY}"` +TMPUNRAR_PATH=$TMPUNRAR_PATH"1" + +if [ ! -d "$TMPUNRAR_PATH" ]; then + mkdir -p $TMPUNRAR_PATH +fi + +#determine if ramdisk is in fstab +if [[ $RAMDISK == "true" ]]; then + if [[ `grep "$TMPUNRAR_PATH" /etc/fstab` ]]; then + if [[ ! `mount | grep "$TMPUNRAR_PATH"` ]]; then + mount "$TMPUNRAR_PATH" + fi + fi +elif [[ $RAMDISK == "true" ]]; then + if [[ ! `mount | grep "$TMPUNRAR_PATH"` ]]; then + mount -t tmpfs -o size=256M tmpfs $TMPUNRAR_PATH + fi +fi + +#remove postprocessing scripts +rm -f $DIR/bin/lib/post* +rm -f $DIR/bin/lib/book.php +rm -f $DIR/bin/lib/console.php +rm -f $DIR/bin/lib/movie.php +rm -f $DIR/bin/lib/music.php +rm -f $DIR/bin/lib/music1.php +rm -f $DIR/bin/lib/nfo.php +rm -f $DIR/bin/lib/tvrage.php +rm -f $DIR/bin/processAdditional* +rm -f $DIR/bin/processAlternate* +rm -f $DIR/bin/lib/nntp2.php +rm -f $DIR/bin/temp/* + +#create postprocessing scripts +for (( c=1; c<=16; c++ )) +do + d=$((($c - 1) * 100)) + cp $NEWZPATH/www/lib/postprocess.php $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/PostProcess/PostProcess$c/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/echo \$iteration.*$/echo \$iteration --.\" \".\$rel['ID'].\" : \".\$rel['name'].\"\\\n\";/" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/processAdditional/processAdditional$c/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/\$tmpPath = \$this->site->tmpunrarpath;/\$tmpPath = \$this->site->tmpunrarpath; \\ + \$tmpPath .= '1\/tmp$c';/g" $DIR/bin/temp/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 * 100, \$numtoProcess));/g" $DIR/bin/temp/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 ...\\n\";/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/\/\/echo \"PostPrc : Fetching/echo \"PostPrc : Fetching/g" $DIR/bin/temp/postprocess$c.php + if [[ $USE_TWO_NNTP == "true" ]] && [[ $USE_TWO_PP != "true" ]]; then + $SED -i -e "s/require_once(WWW_DIR.\"\/lib\/nntp.php\");/require(dirname(__FILE__).\"\/nntp2.php\");/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/new Nntp;/new GetConnected;/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/doConnect/doConnect2/g" $DIR/bin/temp/postprocess$c.php + fi + cp $DIR/bin/lib/additional $DIR/bin/temp/processAdditional$c.php + $SED -i -e "s/1/$c/g" $DIR/bin/temp/processAdditional$c.php + $SED -i -e "s/$numtoProcess = 100;/$numtoProcess = 20;/g" $DIR/bin/temp/postprocess$c.php +done + +for (( c=17; c<=32; c++ )) +do + d=$((($c - 1) * 100)) + cp $NEWZPATH/www/lib/postprocess.php $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/PostProcess/PostProcess$c/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/echo \$iteration.*$/echo \$iteration --.\" \".\$rel['ID'].\" : \".\$rel['name'].\"\\\n\";/" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/processAdditional/processAdditional$c/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/\$tmpPath = \$this->site->tmpunrarpath;/\$tmpPath = \$this->site->tmpunrarpath; \\ + \$tmpPath .= '1\/tmp$c';/g" $DIR/bin/temp/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 + 16) * 100, \$numtoProcess));/g" $DIR/bin/temp/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 ...\\n\";/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/\/\/echo \"PostPrc : Fetching/echo \"PostPrc : Fetching/g" $DIR/bin/temp/postprocess$c.php + if [[ $USE_TWO_NNTP == "true" ]] && [[ $USE_TWO_PP == "true" ]]; then + $SED -i -e "s/require_once(WWW_DIR.\"\/lib\/nntp.php\");/require(dirname(__FILE__).\"\/nntp2.php\");/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/new Nntp;/new GetConnected;/g" $DIR/bin/temp/postprocess$c.php + $SED -i -e "s/doConnect/doConnect2/g" $DIR/bin/temp/postprocess$c.php + fi + cp $DIR/bin/lib/additional $DIR/bin/temp/processAdditional$c.php + $SED -i -e "s/1/$c/g" $DIR/bin/temp/processAdditional$c.php + $SED -i -e "s/$numtoProcess = 100;/$numtoProcess = 20;/g" $DIR/bin/temp/postprocess$c.php +done + +cp -f $NEWZPATH/www/lib/nfo.php $DIR/bin/temp/nfo.php +#cp -f $NEWZPATH/www/lib/tvrage.php $DIR/bin/temp/tvrage.php +cp -f $NEWZPATH/www/lib/movie.php $DIR/bin/temp/movie.php +cp -f $NEWZPATH/www/lib/music.php $DIR/bin/temp/music.php +cp -f $NEWZPATH/www/lib/music.php $DIR/bin/temp/music1.php +cp -f $NEWZPATH/www/lib/console.php $DIR/bin/temp/console.php +cp -f $NEWZPATH/www/lib/book.php $DIR/bin/temp/book.php +cp -f $NEWZPATH/www/lib/nntp.php $DIR/bin/temp/nntp2.php + + +$SED -i -e "s/function doConnect/function doConnect2/" $DIR/bin/temp/nntp2.php +$SED -i -e "s/NNTP_USERNAME/NNTP_USERNAME2/g" $DIR/bin/temp/nntp2.php +$SED -i -e "s/NNTP_PASSWORD/NNTP_PASSWORD2/g" $DIR/bin/temp/nntp2.php +$SED -i -e "s/NNTP_SERVER/NNTP_SERVER2/g" $DIR/bin/temp/nntp2.php +$SED -i -e "s/NNTP_PORT/NNTP_PORT2/g" $DIR/bin/temp/nntp2.php +$SED -i -e "s/NNTP_SSLENABLED/NNTP_SSLENABLED2/g" $DIR/bin/temp/nntp2.php +$SED -i -e "s/NNTPException/NNTPException2/g" $DIR/bin/temp/nntp2.php +$SED -i -e "s/class Nntp/class GetConnected/g" $DIR/bin/temp/nntp2.php + +$SED -i -e "s/500/250/" $DIR/bin/temp/postprocess1.php +$SED -i -e "s/500/250/" $DIR/bin/temp/postprocess2.php + +$SED -i -e "s/class Nfo/class Nfo1/" $DIR/bin/temp/nfo.php +#$SED -i -e "s/class TvRage/class TvRage1/" $DIR/bin/temp/tvrage.php +$SED -i -e "s/class Movie/class Movie1/" $DIR/bin/temp/movie.php +$SED -i -e "s/class Music/class Music1/" $DIR/bin/temp/music.php +$SED -i -e "s/class Music/class Music2/" $DIR/bin/temp/music1.php +$SED -i -e "s/class Console/class Console1/" $DIR/bin/temp/console.php +$SED -i -e "s/class Book/class Book1/" $DIR/bin/temp/book.php + +$SED -i -e "s/function Nfo/function Nfo1/" $DIR/bin/temp/nfo.php +#$SED -i -e "s/function TvRage/function TvRage1/" $DIR/bin/temp/tvrage.php +$SED -i -e "s/function Movie/function Movie1/" $DIR/bin/temp/movie.php +$SED -i -e "s/function Music/function Music1/" $DIR/bin/temp/music.php +$SED -i -e "s/function Music/function Music2/" $DIR/bin/temp/music1.php +$SED -i -e "s/function Console/function Console1/" $DIR/bin/temp/console.php +$SED -i -e "s/function Book/function Book1/" $DIR/bin/temp/book.php + +$SED -i -e "s/processNfoFiles/processNfoFiles1/" $DIR/bin/temp/nfo.php +$SED -i -e "s/processMovieReleases/processMovieReleases1/" $DIR/bin/temp/movie.php +$SED -i -e "s/processMusicReleases/processMusicReleases1/" $DIR/bin/temp/music.php +$SED -i -e "s/processMusicReleases/processMusicReleases2/" $DIR/bin/temp/music1.php +$SED -i -e "s/processBookReleases/processBookReleases1/" $DIR/bin/temp/book.php +$SED -i -e "s/processConsoleReleases/processConsoleReleases1/" $DIR/bin/temp/console.php + +$SED -i -e "s/nfoHandleError/nfoHandleError1/" $DIR/bin/temp/nfo.php +$SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" $DIR/bin/temp/nfo.php + +$SED -i -e 's/WWW_DIR."\/lib\/nfo.php"/"nfo.php"/g' $DIR/bin/temp/postprocess2.php +$SED -i -e 's/WWW_DIR."\/lib\/movie.php"/"movie.php"/g' $DIR/bin/temp/postprocess2.php +$SED -i -e 's/WWW_DIR."\/lib\/music.php"/"music.php"/g' $DIR/bin/temp/postprocess1.php +$SED -i -e 's/WWW_DIR."\/lib\/music.php"/"music1.php"/g' $DIR/bin/temp/postprocess2.php +$SED -i -e 's/WWW_DIR."\/lib\/console.php"/"console.php"/g' $DIR/bin/temp/postprocess2.php +$SED -i -e 's/WWW_DIR."\/lib\/book.php"/"book.php"/g' $DIR/bin/temp/postprocess2.php +#$SED -i -e 's/WWW_DIR."\/lib\/tvrage.php"/"tvrage.php"/g' $DIR/bin/temp/postprocess2.php + +$SED -i -e "s/processNfos()/processNfos1()/g" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/processMovies()/processMovies1()/g" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/processMusic()/processMusic1()/g" $DIR/bin/temp/postprocess1.php +$SED -i -e "s/processMusic()/processMusic2()/g" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/processBooks()/processBooks1()/g" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/processGames()/processGames1()/g" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/processTv()/processTv1()/g" $DIR/bin/temp/postprocess2.php + +$SED -i -e "s/new Nfo/new Nfo1/" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/new Movie/new Movie1/" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/new Music/new Music1/" $DIR/bin/temp/postprocess1.php +$SED -i -e "s/new Music/new Music2/" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/new Book/new Book1/" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/new Console/new Console1/" $DIR/bin/temp/postprocess2.php + +$SED -i -e "s/processNfoFiles/processNfoFiles1/" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/processMovieReleases()/processMovieReleases1()/" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/processMusicReleases()/processMusicReleases1()/" $DIR/bin/temp/postprocess1.php +$SED -i -e "s/processMusicReleases()/processMusicReleases2()/" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/processBookReleases()/processBookReleases1()/" $DIR/bin/temp/postprocess2.php +$SED -i -e "s/processConsoleReleases()/processConsoleReleases1()/" $DIR/bin/temp/postprocess2.php + +$SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" $DIR/bin/temp/nfo.php +$SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" $DIR/bin/temp/movie.php +$SED -i -e "s/ORDER BY createddate DESC/ORDER BY createddate ASC/" $DIR/bin/temp/movie.php +$SED -i -e "s/ORDER BY postdate DESC LIMIT 1000/ORDER BY postdate DESC LIMIT 100/" $DIR/bin/temp/music.php +$SED -i -e "s/ORDER BY postdate DESC LIMIT 1000/ORDER BY postdate ASC LIMIT 100/" $DIR/bin/temp/music1.php +$SED -i -e "s/ORDER BY createddate DESC/ORDER BY createddate DESC/" $DIR/bin/temp/music.php +$SED -i -e "s/ORDER BY createddate DESC/ORDER BY createddate ASC/" $DIR/bin/temp/music1.php +$SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" $DIR/bin/temp/book.php +$SED -i -e "s/ORDER BY postdate DESC/ORDER BY postdate ASC/" $DIR/bin/temp/console.php +$SED -i -e "s/ORDER BY createddate DESC/ORDER BY createddate ASC/" $DIR/bin/temp/console.php + +#$SED -i -e "s/order by postdate desc/ORDER BY postdate ASC/" $DIR/bin/temp/tvrage.php +#$SED -i -e "s/order by rageID asc/order by rageID DESC/" $DIR/bin/temp/tvrage.php +#$SED -i -e "s/order by airdate asc/order by airdate DESC/" $DIR/bin/temp/tvrage.php +#$SED -i -e "s/order by tvrage.releasetitle asc/order by tvrage.releasetitle DESC/" $DIR/bin/temp/tvrage.php + + +if ! grep -q '//$this->rarfileregex =' "$NEWZPATH/www/lib/nzbinfo.php" ; then + $SED -i -e 's/$this->rarfileregex =/\/\/$this->rarfileregex =/' $NEWZPATH/www/lib/nzbinfo.php + $SED -i.bak "39r $DIR/bin/scripts/regex.txt" $NEWZPATH/www/lib/nzbinfo.php +fi diff --git a/bin/scripts/regex.txt b/bin/scripts/regex.txt new file mode 100644 index 000000000..81e230e4f --- /dev/null +++ b/bin/scripts/regex.txt @@ -0,0 +1 @@ + $this->rarfileregex = '/.*\W(?:part0*1|(?!part\d+)[^.]+)\.rar[ "\)\]\-]|.*\W(?:"[\w.\-\',;& ]|(?!"[\w.\-\',;& ]+)[^.]+)\.(001|((?=10[ "\)\]\-].+\(\d{1,3}\/\d{2,3})10|11)|r01|part01)[ "\)\]\-]/i'; diff --git a/bin/temp/.gitignore b/bin/temp/.gitignore new file mode 100644 index 000000000..72e8ffc0d --- /dev/null +++ b/bin/temp/.gitignore @@ -0,0 +1 @@ +* diff --git a/conf/jonnyboys_defaults.sh b/conf/jonnyboys_defaults.sh index f8e2409fb..a2fa2b933 100644 --- a/conf/jonnyboys_defaults.sh +++ b/conf/jonnyboys_defaults.sh @@ -14,7 +14,7 @@ export RUNNING="true" #these scripts set the 'nice'ness of each script, default is 19, the lowest, the highest is -20 #anything between -1 and -20 require root/sudo to run -export NICENESS="1" +export NICENESS="10" #these scripts can add some serious load to your system, without proper monitoring it can be #to much, you can set the max load that any pane will be started at @@ -46,55 +46,58 @@ export ADMIN_PATH=$NEWZPATH"/www/admin" #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, but not category processing #the first window has up to 16 postprocess and can use primary or alternate NNTP provider -export POST_TO_RUN_A="16" +export POST_TO_RUN_A="0" #The second window also has 16 processes and can use promary or alternate NNTP provider -export POST_TO_RUN_B="16" +export POST_TO_RUN_B="0" #by modifying www/config.php like http://pastebin.com/VgH9DCZw, you can use 1 provider to run update_binaries #and backup and another provider to run post processing with. Or, 1 provider to run up to 16 postprocesses and another to run #up to 16 more postprocesses, or the same provider for everything #you can not switch providers without resetting all groups and truncating, I have included a script in scripts folders to reset and truncate #sudo scripts/reset_truncate.php +#it is not necessary to run reset_truncate.php in order to second nntp provider for postprocessing only #this one sets 1 provider for everything(false), or first provider for update_binaries and backfill and another for postprocessing(true) +#this can not be changed after starting scripts export USE_TWO_NNTP="true" #this allows you split the 32 postprocessing into 2 separate providers +#this can not be changed after starting scripts export USE_TWO_PP="true" ############################################################ #post processing per category, setting the above to 0 does not disable these #run processNfos -export NFOS="true" +export NFOS="false" #run processGames -export GAMES="true" +export GAMES="false" #run processMovies -export MOVIES="true" +export MOVIES="false" #run processMusic -export MUSIC="true" +export MUSIC="false" #run processTV -export TVRAGE="true" +export TVRAGE="false" #run processEbook -export EBOOK="true" +export EBOOK="false" #run processOther -export OTHERS="true" +export OTHERS="false" #run processUnwanted -export UNWANTED="true" +export UNWANTED="false" ############################################################ #Enter the session name to be used by tmux, no spaces allowed in the name, this can be changed after scripts start #if you are running multiple servers, you could put your hostname here -export TMUX_SESSION="Ubuntu-02-HOME" +export TMUX_SESSION="Newznab" #Set, in seconds - how often the monitor.php (left top pane) script should update run the queries against the database #the monitor script will update itself and each pane, once every 5 seconds plus the lagg time time on the loop the db is queried @@ -131,7 +134,7 @@ export BACKFILL_SEQ_TIMER="10" ############################################################ #Choose to run update_binaries true/false -export BINARIES="truef" +export BINARIES="false" #Choose to run the threaded or non-threaded newznab binaries scripts true/false #update_binaries.php or update_binaries_threaded.php @@ -140,7 +143,7 @@ export BINARIES_THREADS="false" #Set, in seconds - how long the update_binaries should sleep between runs #top right pane #sleep timers are not used when using SEQ -export BINARIES_SLEEP="15" +export BINARIES_SLEEP="40" #Set the max amount of unprocessed releases and still allow update_binaries to run #set to 0 to disable @@ -158,7 +161,7 @@ export BINARIES_MAX_ROWS="0" ############################################################ #Choose to run backfill script true/false -export BACKFILL="trued" +export BACKFILL="false" #Choose to run the threaded or non-threaded newznab backfill scripts true/false #backfill.php or backfill_threaded.php @@ -167,7 +170,7 @@ export BACKFILL_THREADS="false" #Set, in seconds - how long the backfill should sleep between runs #in pane below update_binaries #sleep timers are not used when using SEQ -export BACKFILL_SLEEP="15" +export BACKFILL_SLEEP="40" #Set the max amount of unprocessed releases and still allow backfill to run #set to 0 to disable @@ -186,7 +189,7 @@ export BACKFILL_MAX_ROWS="0" #this will increment your database by 1 after each backfill loop #once your backfill numbers reach $MAXDAYS, then it will no long increment the database #backfill will continue to run, and do no work, at that point you should disable backfill, below -export MAXDAYS="100" +export MAXDAYS="210" ############################################################ @@ -196,7 +199,7 @@ export MAXDAYS="100" #it will be skipped (target reached). When that group is done, it will do another ( again from z to a). #this does not use increment, it works by the date set below #you also need to enable kevin's compression mod, those files are needed and you still need to enable BACKFILL -export KEVIN_SAFER="trued" +export KEVIN_SAFER="false" #use kevin123's backfill_parts.php instead of normal backfill export KEVIN_BACKFILL_PARTS="false" @@ -205,7 +208,7 @@ export KEVIN_BACKFILL_PARTS="false" export KEVIN_THREADED="false" #set the date to go back to, must be in the format of YYYY-MM-DD, like 2012-06-24, this is the date of the posted nzbs -export KEVIN_DATE="2010-01-01" +export KEVIN_DATE="2012-06-24" #set the number of articles/headers to download at one time export KEVIN_PARTS="100000" @@ -214,7 +217,7 @@ export KEVIN_PARTS="100000" #Set the path to the nzb dump you downloaded from torrents, this is the path to bulk files folder of nzbs #this does not recurse through subfolders, unless you set NZB_THREADS to true -export NZBS="/home/jonnyboy/nzb_files2" +export NZBS="/home/jonnyboy/nzb_files2/nzbs" #Choose to run import nzb script true/false export IMPORT="true" @@ -230,7 +233,7 @@ export NZB_THREADS="true" export NZB_FOLDER_COUNT="50" #How many nzbs to import per loop, if using NZB_THREADS=true the per folder -export NZBCOUNT="50" +export NZBCOUNT="10" #Set, in seconds - how long the nzb-import should sleep between runs #below backfill @@ -242,7 +245,7 @@ export IMPORT_MAX_RELEASES="0" #Set the max amount of of rows in the parts table and still allow nzb-import to run #set to 0 to disable -export IMPORT_MAX_ROWS="0" +export IMPORT_MAX_ROWS="10000000" #import nzbs using the filename as the release name true/false export IMPORT_TRUE="true" @@ -271,19 +274,19 @@ export OPTIMIZE="false" #optimize can wait, patiently while all other panes stop and then run #or, forcefully terminate all panes while it runs, to kill all panes and run optimize, enable -export OPTIMIZE_KILL="true" +export OPTIMIZE_KILL="false" #How often to run optimize_myisam on small tables seconds, default is 10 min -export MYISAM_SMALL="600000" +export MYISAM_SMALL="600" #How often to run optimize_myisam on large tables seconds, default is 1 hr -export MYISAM_LARGE="600000" +export MYISAM_LARGE="3600" #How often to run optimize_innodb on small tables in seconds, default is 2 hr export INNODB_SMALL="7200" #How often to run optimize_innodb on large tables in seconds, default is 48 hrs -export INNODB_LARGE="14400" +export INNODB_LARGE="172800" ############################################################ @@ -302,32 +305,32 @@ export CLEANUP="false" export CLEANUP_EDIT="true" #How often do you want update_cleanup.php and removespecial.php to run, in seconds -export CLEANUP_TIMER="1800" +export CLEANUP_TIMER="3600" ############################################################ #Choose to run update_parsing.php true/false #set to false by default, you will need to edit /misc/testing/update_parsing.php #to actually do anything, directions are in the file -export PARSING="false" +export PARSING="true" #choose to use kevin123's update_parsing script #this also includes kevin123's categorymod.php, you must run either update_svn.sh or fix_files.sh to copy the file into place export PARSING_MOD="true" #choose to use cj's fix_android_releases.php -export FIX_DROID="false" +export FIX_DROID="true" #run update_parsing.php against the whole db or just the last 24 hours export PAST_24_HOURS="false" #How often do you want update_parsing.php to run, in seconds. this takes alot of memory and processing time, default is every 12 hrs -export PARSING_TIMER="900" +export PARSING_TIMER="43200" ############################################################ #Choose to run update_predb.php -export PREDB="false" +export PREDB="true" #How often to update the PreDB in seconds export PREDB_TIMER="900" @@ -346,7 +349,7 @@ export SPOTNAB_ACTIVE="true" ############################################################ #update the tv schedule and in theaters listings -export TV_SCHEDULE="false" +export TV_SCHEDULE="true" #How often to update the TV Schedule and the In Theaters in seconds export TVRAGE_TIMER="43200" @@ -364,7 +367,7 @@ export SPHINX_TIMER="3600" #mediainfo and ffmpeg can hang occasionally, set timer, in seconds, to anything other than 0 to enable #it should not need to run longer that 120 seconds -export KILL_PROCESS="120" +export KILL_PROCESS="0" #look at man killall - if you have the -q option, enable this, otherwise leave it disabled export KILL_QUIET="true" @@ -373,17 +376,17 @@ export KILL_QUIET="true" #Delete parts and binaries older than retention days, which is set in edit - site #this uses a script posted by cj https://github.com/NNScripts/nn-custom-scripts -export DELETE_PARTS="false" +export DELETE_PARTS="true" #how often should this be run, default it 1 hr export DELETE_TIMER="3600" #Releases may be added/edited with an imdb-id that does not exists in the movieinfo table. This script, update_missing_movie_info, #will fetch all the missing imdb id's from the releases table. -export FETCH_MOVIE="false" +export FETCH_MOVIE="true" #how often should this be run, default it 12 hr -export MOVIE_TIMER="3600" +export MOVIE_TIMER="43200" ############################################################ @@ -407,14 +410,14 @@ export USE_ATOP="false" export USE_NMON="false" export USE_IOTOP="false" -#define tcptrack user settings to apply at runtime -export USE_TCPTRACK="truek" -export TRCPTRACK_ARGS="-i eth0 port 563" - -#define vnstat user settings to apply at runtim +#define vnstat user settings to apply at runtime export USE_VNSTAT="false" export VNSTAT_ARGS="" +#define tcptrack user settings to apply at runtime +export USE_TCPTRACK="false" +export TRCPTRACK_ARGS="-i eth0 port 443" + #freebsd does not have iotop, but can run top -m io -o total export USE_TOP="false" @@ -566,4 +569,3 @@ if [[ $POWERLINE == "true" ]]; then else export TMUX_CONF="conf/tmux.conf" fi - diff --git a/scripts/fix_files.sh b/scripts/fix_files.sh index 033ee8b4d..fae3e4571 100755 --- a/scripts/fix_files.sh +++ b/scripts/fix_files.sh @@ -24,31 +24,31 @@ rm -fv * #edit cleanup scripts if [[ $CLEANUP_EDIT == "true" ]]; then echo "editing cleanup scripts" - sed -i -e 's/^$echo =.*$/$echo = false;/' $TESTING_PATH/update_parsing.php - sed -i -e 's/^$limited =.*$/$limited = false;/' $TESTING_PATH/update_parsing.php - sed -i -e 's/^$echo =.*$/$echo = false;/' $TESTING_PATH/update_cleanup.php - sed -i -e 's/^$limited =.*$/$limited = false;/' $TESTING_PATH/update_cleanup.php + $SED -i -e 's/^$echo =.*$/$echo = false;/' $TESTING_PATH/update_parsing.php + $SED -i -e 's/^$limited =.*$/$limited = false;/' $TESTING_PATH/update_parsing.php + $SED -i -e 's/^$echo =.*$/$echo = false;/' $TESTING_PATH/update_cleanup.php + $SED -i -e 's/^$limited =.*$/$limited = false;/' $TESTING_PATH/update_cleanup.php fi #edit powerprocess.php if [[ $FIX_POSIX == "true" ]]; then echo "editing powerprocess" - sed -i -e 's/case SIGSTKFLT:/\/\/case SIGSTKFLT:/' $NEWZPATH/www/lib/powerprocess.php - sed -i -e 's/return 'SIGSTKFLT';/\/\/return 'SIGSTKFLT';/' $NEWZPATH/www/lib/powerprocess.php - sed -i -e 's/case SIGCLD:/\/\/case SIGCLD:/' $NEWZPATH/www/lib/powerprocess.php - sed -i -e 's/return 'SIGCLD';/\/\/return 'SIGCLD';/' $NEWZPATH/www/lib/powerprocess.php - sed -i -e 's/case SIGPOLL:/\/\/case SIGPOLL:/' $NEWZPATH/www/lib/powerprocess.php - sed -i -e 's/return 'SIGPOLL';/\/\/return 'SIGPOLL';/' $NEWZPATH/www/lib/powerprocess.php - sed -i -e 's/case SIGPWR:/\/\/case SIGPWR:/' $NEWZPATH/www/lib/powerprocess.php - sed -i -e 's/return 'SIGPWR';/\/\/return 'SIGPWR';/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/case SIGSTKFLT:/\/\/case SIGSTKFLT:/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/return 'SIGSTKFLT';/\/\/return 'SIGSTKFLT';/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/case SIGCLD:/\/\/case SIGCLD:/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/return 'SIGCLD';/\/\/return 'SIGCLD';/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/case SIGPOLL:/\/\/case SIGPOLL:/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/return 'SIGPOLL';/\/\/return 'SIGPOLL';/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/case SIGPWR:/\/\/case SIGPWR:/' $NEWZPATH/www/lib/powerprocess.php + $SED -i -e 's/return 'SIGPWR';/\/\/return 'SIGPWR';/' $NEWZPATH/www/lib/powerprocess.php fi #attempt to get english only from IMDB if [[ $EN_IMDB == "true" ]]; then echo "edit movie language" - sed -i -e 's/akas.imdb/www.imdb/g' $NEWZPATH/www/lib/movie.php - sed -i -e 's/akas.imdb/www.imdb/g' $TESTING_PATH/update_parsing.php - sed -i -e 's/curl_setopt($ch, CURLOPT_URL, $url);/curl_setopt($ch, CURLOPT_URL, $url);\ + $SED -i -e 's/akas.imdb/www.imdb/g' $NEWZPATH/www/lib/movie.php + $SED -i -e 's/akas.imdb/www.imdb/g' $TESTING_PATH/update_parsing.php + $SED -i -e 's/curl_setopt($ch, CURLOPT_URL, $url);/curl_setopt($ch, CURLOPT_URL, $url);\ $header[] = "Accept-Language: en-us";\ curl_setopt($ch, CURLOPT_HTTPHEADER, $header);/' $NEWZPATH/www/lib/util.php fi diff --git a/scripts/reset_rar_check.php b/scripts/reset_rar_check.php new file mode 100755 index 000000000..050f51afb --- /dev/null +++ b/scripts/reset_rar_check.php @@ -0,0 +1,9 @@ +query("update releases set passwordstatus = -1 where rarinnerfilecount = 0"); + +?> diff --git a/start.sh b/start.sh index 7a1588923..c1af62e0f 100755 --- a/start.sh +++ b/start.sh @@ -15,28 +15,31 @@ if [ ! -f defaults.sh ]; then exit fi -# Make sure only root can run our script -#if [[ $EUID -ne 0 ]]; then - #echo "This script must be run as root" - #This was removed by popular request, so don't complain - #exit 1 -#fi - source config.sh source defaults.sh eval $( $SED -n "/^define/ { s/.*('\([^']*\)', '*\([^']*\)'*);/export \1=\"\2\"/; p }" "$NEWZPATH"/www/config.php ) if [[ $AGREED == "no" ]]; then - echo "Please edit the defaults.sh file" - exit + echo "Please edit the defaults.sh file" + exit +fi + +$DIR/bin/scripts/check_vars.sh & +pid=$! +wait $! +script_exit_value=$? +if [ "${script_exit_value}" -ne "0" ] ; then + exit 1 fi -bin/preflight.sh & #check if tmux session exists, attach if exists, create new if not exist if $TMUXCMD -q has-session -t $TMUX_SESSION; then - $TMUXCMD attach-session -t $TMUX_SESSION + $TMUXCMD attach-session -t $TMUX_SESSION else + + $DIR/bin/scripts/preflight.sh & + printf "The above is just a TMUX notice, it is saying TMUX, that you do not have a TMUX session currently running. It is not an error. It is TMUX" printf "\033]0; $TMUX_SESSION\007\003\n"