Acfs status and stop
#!/bin/bash
# Prompt for log directory
read -p "Enter the log directory path: " log_directory
# Create the log directory if it doesn't exist
mkdir -p "$log_directory"
# Log file path
log_file="$log_directory/acfs_script_log_$(date '+%Y%m%d_%H%M%S').log"
# Redirect all output to the log file
exec > "$log_file" 2>&1
echo "Script started at $(date)"
# To stop ACFS replication
for value in $(df -kh | grep gg | awk '{print $NF}' | sed -n '2p'); do
acfsutil repl info -c "$value"
acfsutil repl bg stop "$value"
if [ $? -eq 0 ]; then
echo "ACFS replication stopped for $value"
fi
done
# To stop the filesystem
for value in $(df -kh | grep gg | awk '{print $1}' | sed -n '2p'); do
srvctl status filesystem -d "$value"
srvctl stop filesystem -d "$value"
if [ $? -ne 0 ]; then
echo "Issues stopping filesystem $value. Checking ASM proxy status on respective node and retrying..."
# Extract nodes from the output of `srvctl status asm -proxy`
proxy_nodes=$(srvctl status asm -proxy | awk '{for (i=7;i<=NF;i++) print $i}')
# Loop through each node and stop ASM proxy
for node in $proxy_nodes; do
srvctl stop asm -proxy -n $node
echo "ASM proxy halted on $node. Retry stopping ACFS filesystem $value..."
done
fi
done
echo "Script completed at $(date)"
Comments
Post a Comment