diff --git a/keepalive.sh b/keepalive.sh index 47c053c..74839b0 100755 --- a/keepalive.sh +++ b/keepalive.sh @@ -1,10 +1,21 @@ #!/bin/bash - while true; do -source .env 2> /dev/null -KEEP_ALIVE=$(curl -s 'https://faisanet.mib.com.mv/aProfile/keepAlive' \ - -X 'POST' \ - -H "cookie: ql_0=${QL_0}; IBSID=${IBSID}") -echo $KEEP_ALIVE -sleep $SLEEP + source .env 2> /dev/null + + # Get current date and time + CURRENT_TIME=$(date -u '+%Y-%m-%dT%H:%M:%S.%3NZ') + + # Make the keep-alive request + KEEP_ALIVE=$(curl -s 'https://faisanet.mib.com.mv/aProfile/keepAlive' \ + -X 'POST' \ + -H "cookie: ql_0=${QL_0}; IBSID=${IBSID}") + + # Remove the last closing brace from KEEP_ALIVE + KEEP_ALIVE_MODIFIED=${KEEP_ALIVE%?} + + # Combine timestamp with the keep-alive response + echo "$KEEP_ALIVE_MODIFIED, \"timestamp\":\"$CURRENT_TIME\"}" + + # Sleep for the specified duration + sleep $SLEEP done