#!/bin/bash

svc=`curl -s -L --negotiate -u : 'https://oncall.amazon.com/mason-handler.fcgi/index.mhtml?name=emr-service-primary' \
| grep -a2 Login | grep -e '"datetime"' | awk '{split($0,a,"<"); print a[4]}' | awk '{split($0,a,">"); print a[2]}'`

svc_oc=`curl -s -L --negotiate -u : "https://oncall.amazon.com/mason-handler.fcgi/index.mhtml?name=$svc" \
 | grep -a2 Login | grep -e '"datetime"' | awk '{split($0,a,"<"); print a[4]}' | awk '{split($0,a,">"); print a[2]}'`

dp_oc=`curl -s -L --negotiate -u : "https://oncall.amazon.com/mason-handler.fcgi/index.mhtml?name=emr-dataplane-primary" \
 | grep -a2 Login | grep -e '"datetime"' | awk '{split($0,a,"<"); print a[4]}' | awk '{split($0,a,">"); print a[2]}'`

echo "Current service oncall : $svc_oc"
echo "Current dataplane oncall : $dp_oc"
