From f8b201d5b6818afdc234bd3119ae36fdf6b1d31e Mon Sep 17 00:00:00 2001 From: aaearon Date: Mon, 31 Dec 2012 08:51:59 -0500 Subject: [PATCH] fixed where 'and during first loop' should work now all the time --- bin/cleanup_scripts.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/cleanup_scripts.sh b/bin/cleanup_scripts.sh index cb46ade77..5f4e3c9fc 100755 --- a/bin/cleanup_scripts.sh +++ b/bin/cleanup_scripts.sh @@ -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