Created
February 9, 2014 20:10
-
-
Save jensihnow/8905218 to your computer and use it in GitHub Desktop.
TaHoma logger - simple getEvents caller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# while loop for permanent processing | |
while : | |
do | |
# TaHoma LogIn | |
echo `curl -s -k -A "TaHoma/1.7.1 CFNetwork/548.0.4 Darwin/11.0.0" -b ./cookie.txt -c ./cookie.txt --data "userId=<USERID>&userPassword=<PASSWORD>" https://iphone-v17.overkiz.com/enduser-mobile-web/externalAPI/login` | |
while : | |
do | |
# define timestamp and starttime | |
STARTTIME=`date +%s` | |
TIMESTAMP=`date +"%Y-%m-%d %T"` | |
# TaHoma Getting Data | |
RESPONSE=`curl -s -k -A "TaHoma/1.7.1 CFNetwork/548.0.4 Darwin/11.0.0" -b ./cookie.txt -c ./cookie.txt https://iphone-v17.overkiz.com/enduser-mobile-web/externalAPI/getEvents` | |
echo -e "$TIMESTAMP $RESPONSE" | |
# Check if response with error or not | |
searchString="errorResponse" | |
if `echo ${RESPONSE} | grep "${searchString}" 1>/dev/null 2>&1` | |
then | |
break | |
fi | |
# Calculate runtime for sleep period | |
ENDTIME=`date +%s` | |
TIMEDELTA=`expr $ENDTIME - $STARTTIME` | |
TIME2WAIT=`expr 10 - $TIMEDELTA` | |
# waiting for next minute | |
sleep $TIME2WAIT | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment