fixed where 'and during first loop' should work now all the time

This commit is contained in:
aaearon
2012-12-31 08:51:59 -05:00
parent bc6549282f
commit f8b201d5b6
+5 -3
View File
@@ -7,7 +7,8 @@ source ../edit_these.sh
LASTOPTIMIZE1=`date +%s`
LASTOPTIMIZE2=`date +%s`
LASTOPTIMIZE3=`date +%s`
while :
i=1
while [ $i -gt 0 ]
do
@@ -18,7 +19,7 @@ cd $NEWZNAB_PATH
CURRTIME=`date +%s`
#every 2 hours and during first loop
DIFF=$(($CURRTIME-$LASTOPTIMIZE1))
if [ "$DIFF" -gt 3600 ] || [ "$DIFF" -lt 1 ]
if [ "$DIFF" -gt 7200 ] || [ $i -eq 1 ]
then
LASTOPTIMIZE1=`date +%s`
cd $NEWZNAB_PATH
@@ -42,7 +43,7 @@ fi
CURRTIME=`date +%s`
#every 12 hours and during 1st loop
DIFF=$(($CURRTIME-$LASTOPTIMIZE3))
if [ "$DIFF" -gt 43200 ] || [ "$DIFF" -lt 1 ]
if [ "$DIFF" -gt 43200 ] || [ $i -eq 1 ]
then
LASTOPTIMIZE3=`date +%s`
cd $NEWZNAB_PATH
@@ -51,6 +52,7 @@ then
[ -f $NEWZNAB_PATH/update_theaters.php ] && $PHP $NEWZNAB_PATH/update_theaters.php
fi
i=`expr $i + 1`
echo "waiting $NEWZNAB_POST_SLEEP_TIME seconds..."
sleep $NEWZNAB_POST_SLEEP_TIME