#!/bin/bash
# Source the R12.2 application environment file
. /path/to/R12.2/envfile
# Specify profile option names and expected values as associative array
declare -A PROFILE_OPTIONS=(
["POS_INTERNAL_URL"]="http://internal.example.com"
["POS_EXTERNAL_URL"]="https://external.example.com"
["APPS_AUTH_AGENT"]="http://auth.example.com"
)
# Set email addresses and subject for report
EMAIL_RECIPIENT="youremail@example.com"
EMAIL_SUBJECT="Profile Option Validation Report"
# Set report file name and path
REPORT_FILE_NAME="profile_option_report.html"
REPORT_FILE_PATH="/path/to/report/directory/$REPORT_FILE_NAME"
# Initialize message and color variables
MESSAGE=""
COLOR="green"
# Loop through profile option names and check their values
for PROFILE_OPTION_NAME in "${!PROFILE_OPTIONS[@]}"; do
EXPECTED_VALUE="${PROFILE_OPTIONS[$PROFILE_OPTION_NAME]}"
# Get current value of profile option
CURRENT_VALUE=$(sqlplus -s username/password << EOF
set heading off feedback off verify off
select PROFILE_OPTION_VALUE from FND_PROFILE_OPTION_VALUES where PROFILE_OPTION_NAME='$PROFILE_OPTION_NAME';
exit;
EOF
)
# Check if the value matches the expected value
if [[ "$CURRENT_VALUE" == "$EXPECTED_VALUE" ]]; then
# Value is correct
MESSAGE+="Profile option '$PROFILE_OPTION_NAME' has the expected value '$EXPECTED_VALUE'<br>"
else
# Value is incorrect
MESSAGE+="Profile option '$PROFILE_OPTION_NAME' has an incorrect value. Expected '$EXPECTED_VALUE', but found '$CURRENT_VALUE'<br>"
COLOR="red"
fi
done
# Create HTML report
echo "<html><body><h2>$MESSAGE</h2></body></html>" > "$REPORT_FILE_PATH"
# Add CSS style to report based on color
echo "<style>h2 {color: $COLOR;}</style>" >> "$REPORT_FILE_PATH"
# Send report via email
mailx -a "Content-Type: text/html" -s "$EMAIL_SUBJECT" "$EMAIL_RECIPIENT" < "$REPORT_FILE_PATH"
No comments:
Post a Comment