#!/bin/bash
# ==============================================================================
# Script Name : sso_validation_post_clone.sh
# Description : Validates SSO Registration after EBS Environment Clone
# Author : Minh
# Date : Feb 05, 2026
# ==============================================================================
# 1. Environment Initialization
cd $HOME
if [ -f "./EBSapps.env" ]; then
. ./EBSapps.env run
echo "[$(date)] Environment sourced successfully."
else
echo "[ERROR] EBSapps.env not found in $HOME. Exiting."
exit 1
fi
# 2. Define Variables
LOG_DIR="$INST_TOP/logs/sso_post_clone"
mkdir -p $LOG_DIR
CHECK_LOG="$LOG_DIR/SSORegCheck_$(date +%Y%m%d_%H%M%S).log"
echo "----------------------------------------------------------"
echo "Starting SSO Registration Check..."
echo "Log File: $CHECK_LOG"
echo "----------------------------------------------------------"
# 3. Execute SSORegCheck
# Using -silent=yes to avoid interactive prompts during automation
perl $FND_TOP/bin/txkrun.pl \
-script=SSORegCheck \
-outdir=$LOG_DIR \
-silent=yes > $CHECK_LOG 2>&1
# 4. Success/Failure Logic
if [ $? -eq 0 ]; then
echo "[SUCCESS] SSO Configuration is valid for $TWO_TASK."
# Optional: Integration with your tracking tools
# Example: Send success status to Jira/Datadog
else
echo "[CRITICAL] SSO Validation Failed for $TWO_TASK!"
echo "Please review the log: $CHECK_LOG"
# You can trigger a PagerDuty alert here if this is a QCT/CORP env
exit 1
fi
echo "----------------------------------------------------------"
echo "Validation Complete."
Note: Ensure you run this script as the applmgr user after the post-clone configuration is complete.