diff --git a/bin/monitor.php b/bin/monitor.php index 762735d46..bbee5b304 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -47,7 +47,7 @@ $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 --defaults-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 @@ -490,7 +490,7 @@ while( $i > 0 ) if ( $array['RAMDISK_PATH'] != "" ) { printf($mask, "Ramdisk", "$disk_use used", "$disk_free free"); } - +echo $_DB_USER; printf("\033[1;33m\n"); printf($mask, "Category", "In Process", "In Database"); printf($mask, "====================", "====================", "===================="); diff --git a/bin/nzbcount.php b/bin/nzbcount.php index bca7c1196..219788000 100644 --- a/bin/nzbcount.php +++ b/bin/nzbcount.php @@ -26,8 +26,8 @@ while ($i==0) { printf($mask, "===============", "==========", "=============\033[0m"); $subdir_count = 0; - $path = $array['NZBS']; - $subdirs = array_filter(glob($path.'/*', GLOB_ONLYDIR|GLOB_NOSORT)); + $subpath = $array['NZBS']; + $subdirs = array_filter(glob($subpath.'/*', GLOB_ONLYDIR|GLOB_NOSORT)); foreach($subdirs AS $subdir){ $subdir_count++; } @@ -74,10 +74,10 @@ while ($i==0) { echo ("\033[1;33m"); printf($mask, "Total","$toprocess","$totalproc"); } else { - $filecount0 = count(glob($path.'/*.nzb')); + $filecount0 = count(glob($subpath.'/*.nzb')); if ( $filecount == 0 ) { $filecount = $filecount0; } $processed=$filecount-$filecount0; - $folder=basename("$path"); + $folder=basename("$subpath"); printf($mask, "$folder","$filecount0","$processed"); } sleep(90); diff --git a/bin/update_binaries_threaded.php b/bin/update_binaries_threaded.php index 89638182a..9f2298c0b 100644 --- a/bin/update_binaries_threaded.php +++ b/bin/update_binaries_threaded.php @@ -80,7 +80,7 @@ if ($ps->RunThreadCode()) $file = 'update_binaries.php'; //$output = shell_exec("php {$dir}/{$file} {$param}"); - $output = passthru("php {$dir}/{$file} {$param}"); + $output = shell_exec("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"; diff --git a/config.sh b/config.sh index 3baec6fc6..3d97049d1 100644 --- a/config.sh +++ b/config.sh @@ -197,7 +197,7 @@ export INNODB="false" #to actually do anything, directions are in the file export CLEANUP="false" -#edit update_cleanup.php and update_parsing.php and svn up +#edit update_cleanup.php and update_parsing.php and svn up, this will only mod files when you run scripts/update_svn.sh or scripts/fix_files.sh export CLEANUP_EDIT="false" #How often do you want update_cleanup.php and removespecial.php to run, in seconds @@ -289,7 +289,7 @@ export RAMDISK="false" ############################################################ #use kevin123's compression mod true/false -#this will copy kevin123's compression mod to the correct location when you update_svn.sh +#this will copy kevin123's compression mod to the correct location when you update_svn.sh or fix_files.sh #this ensures that kevin123's files are present after updaing svn export KEVINS_COMP="false" diff --git a/scripts/fix_files.sh b/scripts/fix_files.sh new file mode 100755 index 000000000..bf975ed90 --- /dev/null +++ b/scripts/fix_files.sh @@ -0,0 +1,55 @@ +#!/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 )" + +# Make sure only root can run our script +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" + exit 1 +fi + +source $DIR/../defaults.sh + +#purge smarty cache +cd $NEWZPATH"/www/lib/smarty/templates_c/" +rm -fv * + +#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 + +#import kevin123's compression mod +if [[ $KEVINS_COMP == "true" ]]; then + cd $NEWZPATH"/misc/update_scripts/nix_scripts/tmux/kevin123" + 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/ + chmod 775 $NEWZPATH/www/lib/smarty/templates_c + chmod -R 775 $NEWZPATH/www/covers + chmod 775 $NEWZPATH/www + chmod 775 $NEWZPATH/www/install +else + chmod 777 $NEWZPATH/www/lib/smarty/templates_c + chmod -R 777 $NEWZPATH/www/covers + chmod 777 $NEWZPATH/www + chmod 777 $NEWZPATH/www/install +fi + diff --git a/scripts/revert.sh b/scripts/revert.sh index 763f1add4..2cf26158b 100755 --- a/scripts/revert.sh +++ b/scripts/revert.sh @@ -34,7 +34,7 @@ fi #Get the path to tmpunrar TMPUNRAR_QUERY="SELECT value from site where setting = \"tmpunrarpath\";" -TMPUNRAR_PATH=`$MYSQL --defaults-extra-file=../conf/my.cnf -u$DB_USER -h$DB_HOST $DB_NAME -s -N -e "${TMPUNRAR_QUERY}"` +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" #remove the ramdisk diff --git a/scripts/update_svn.sh b/scripts/update_svn.sh index 419f711df..f55f4e69c 100755 --- a/scripts/update_svn.sh +++ b/scripts/update_svn.sh @@ -28,41 +28,6 @@ svn export --force --username svnplus --password $SVN_PASSWORD svn://svn.newznab cd $NEWZPATH"/misc/update_scripts" $PHP update_database_version.php -echo " " - -#purge smarty cache -cd $NEWZPATH"/www/lib/smarty/templates_c/" -rm -fv * - -#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 - -#import kevin123's compression mod -if [[ $KEVINS_COMP == "true" ]]; then - cd $NEWZPATH"/misc/update_scripts/nix_scripts/tmux/kevin123" - 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/ - chmod 775 $NEWZPATH/www/lib/smarty/templates_c - chmod -R 775 $NEWZPATH/www/covers - chmod 775 $NEWZPATH/www - chmod 775 $NEWZPATH/www/install -else - chmod 777 $NEWZPATH/www/lib/smarty/templates_c - chmod -R 777 $NEWZPATH/www/covers - chmod 777 $NEWZPATH/www - chmod 777 $NEWZPATH/www/install -fi - +cd $DIR/scripts +ls -al +./fix_files.sh diff --git a/start.sh b/start.sh index 2cf7f8a24..6a4e5d67c 100755 --- a/start.sh +++ b/start.sh @@ -36,7 +36,7 @@ fi if $TMUXCMD -q has-session -t $TMUX_SESSION; then $TMUXCMD attach-session -t $TMUX_SESSION 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 "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" $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' @@ -89,7 +89,7 @@ else #Get the path to tmpunrar TMPUNRAR_QUERY="SELECT value from site where setting = \"tmpunrarpath\";" - TMPUNRAR_PATH=`$MYSQL --defaults-extra-file=conf/my.cnf -u$DB_USER -h$DB_HOST $DB_NAME -s -N -e "${TMPUNRAR_QUERY}"` + 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" #remove the ramdisk, previous versions were smaller @@ -97,13 +97,13 @@ else umount $TMPUNRAR_PATH &> /dev/null fi - #remove and recreate + #remove and recreate, this is to ensure an empty folder for moounting into rm -rf $TMPUNRAR_PATH mkdir -p $TMPUNRAR_PATH #create a ramdisk if [[ $RAMDISK == "true" ]]; then - mountpoint -q $TMPUNRAR_PATH || mount -t tmpfs -o size=256M tmpfs $TMPUNRAR_PATH 2>&1 > /dev/null + mountpoint -q $TMPUNRAR_PATH || mount -t tmpfs -o size=256M tmpfs $TMPUNRAR_PATH fi chmod -R 777 $TMPUNRAR_PATH