Golden gate stop
#!/bin/bash
# Ask the user for the log directory
read -p "Enter the log directory: " log_dir
# Check if the log directory is provided
if [ -z "$log_dir" ]; then
echo "Log directory not provided. Exiting."
exit 1
fi
# Create log directory if it doesn't exist
mkdir -p "$log_dir"
# Get the list of running Goldengate instances
instances=$(agctl status goldengate | grep "is running")
# Loop through each line of the output
while read -r line; do
# Extract information from each line
manager_name=$(echo "$line" | awk '{print $3}')
node=$(echo "$line" | awk '{print $NF}')
# Create a unique log file for each Oracle home
log_file="$log_dir/gg_stop_$manager_name.log"
# SSH to the respective node and stop Oracle GoldenGate Manager
ssh $node "agctl stop goldengate $manager_name" >> "$log_file" 2>&1
done <<< "$instances"
Comments
Post a Comment