Joined
·
13,106 Posts
I have a rather odd problem here. I'm using the "%" operator to check if the current hour is a multiple of 3 for an update script. The script works for every hour except "9" where it simply returns null.
Here's the script:
Here's the output from further on in the script:
Here's the script:
Code:
#!/bin/bash
cd /media/mirror/folding/OCN/
NOWDATE=`date +%y-%m-%d_%H`
CURHOUR=`date +%H`
MOD_RESULT=$(( $CURHOUR % 3 ))
echo "-------------------------------------------------------------------------"
echo "TIMESTAMP:"
date
echo "MOD_RESULT: $MOD_RESULT"
if [ $MOD_RESULT == 0 ];
then
echo "3-hour update started"
ruby ./p_script.rb
python ./p_import.py
else
echo "Using previous update file"
python ./p_import.py
fi
echo "" >> ./p_log.txt
Code:
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 00:34:58 UTC 2013
MOD_RESULT: 0
3-hour update started
Auto Hourly Update for: 23-Feb-2013 @ 0:00 using file: passkey_output.csv
Adding new day: 23-Feb-2013
Updating user info for hour 0
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 01:33:04 UTC 2013
MOD_RESULT: 1
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 1:00 using file: passkey_output.csv
Updating user info for hour 1
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 02:31:45 UTC 2013
MOD_RESULT: 2
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 2:00 using file: passkey_output.csv
Updating user info for hour 2
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 03:32:57 UTC 2013
MOD_RESULT: 0
3-hour update started
Auto Hourly Update for: 23-Feb-2013 @ 3:00 using file: passkey_output.csv
Updating user info for hour 3
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 04:32:46 UTC 2013
MOD_RESULT: 1
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 4:00 using file: passkey_output.csv
Updating user info for hour 4
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 05:33:06 UTC 2013
MOD_RESULT: 2
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 5:00 using file: passkey_output.csv
Updating user info for hour 5
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 06:33:00 UTC 2013
MOD_RESULT: 0
3-hour update started
Auto Hourly Update for: 23-Feb-2013 @ 6:00 using file: passkey_output.csv
Updating user info for hour 6
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 07:33:18 UTC 2013
MOD_RESULT: 1
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 7:00 using file: passkey_output.csv
Updating user info for hour 7
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 08:32:53 UTC 2013
MOD_RESULT:
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 8:00 using file: passkey_output.csv
Updating user info for hour 8
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 09:33:08 UTC 2013
MOD_RESULT:
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 9:00 using file: passkey_output.csv
Updating user info for hour 9
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 10:33:01 UTC 2013
MOD_RESULT: 1
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 10:00 using file: passkey_output.csv
Updating user info for hour 10
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 11:33:09 UTC 2013
MOD_RESULT: 2
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 11:00 using file: passkey_output.csv
Updating user info for hour 11
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 12:33:37 UTC 2013
MOD_RESULT: 0
3-hour update started
Auto Hourly Update for: 23-Feb-2013 @ 12:00 using file: passkey_output.csv
Updating user info for hour 12
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 13:33:32 UTC 2013
MOD_RESULT: 1
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 13:00 using file: passkey_output.csv
Updating user info for hour 13
---------------------------------------------------------------------------------------
TIMESTAMP:
Sat Feb 23 14:35:46 UTC 2013
MOD_RESULT: 2
Using previous update file
Auto Hourly Update for: 23-Feb-2013 @ 14:00 using file: passkey_output.csv
Updating user info for hour 14