I have a bash script which contains some API's which is taking start & end timestamps. So my requirement is to rollup every week Start Timestamp : Should always points to current week monday 7 AM PST (This should be in Timestamp.. Ex : 1596463200) End Timestamp : Should always points to current week sunday 11: 59 PM PST (This should be in Timestamp.. Ex : 1597042740)
Can any one guide me how i can rollup start timestamps to current week monday and end timestamp to current week sunday.
My bash script looks like this
cat abc.sh
makeAPICall() {
curl -X GET $1 > $2
chmod 755 $2
if [[ $(find $2 -type f -size +100c 2>/dev/null) ]]; then
cp -R $2 /app/apache-tomcat-7.0.88/webapps/WFSReportUI/$2
chmod 755 /app/apache-tomcat-7.0.88/webapps/WFSReportUI/$2
fi
}
endts=`date +%s`
startTs=`date -dmonday +%s`
#startTs=`date -dlast-monday +%s`
makeAPICall "localhost:8080/wsaas-report-app/services/fulfillmentReport/wfsExternalSellers?startTimestamp=$startTs&endTimestamp=$endts&isLastweekReport=false" "WFSCustomerOrderSummary.json"
You need to make the following adaptions
startTs=`date --date='TZ="America/Los_Angeles" monday + 7 hours' +%s`
endts=`date --date='TZ="America/Los_Angeles" next monday - 1 minute' +%s`