Script to unmount drives

July 23, 2024

#!/bin/bash
# Array of mount points to unmount
mount_points=(
  "/share/emcd/fundamental"
  "/share/emcd/commentary"
  "/share/emcd/esg"
  "/share/emfi/client_commentary"
  "/share/quality/models"
  "/share/sa4f/analysts_revisions"
  "/share/sa_credit/co_master"
  "/share/analytics/scorecards/4f/global"
  "/share/analytics/scorecards/4f/sa"
  "/share/analytics/reporting/emd"
  "/share/emfi/tf_holdings"
)
# Iterate over each mount point and unmount it
for mount_point in "${mount_points[@]}"; do
  echo "Unmounting $mount_point"
  sudo umount "$mount_point"
  if [ $? -eq 0 ]; then
    echo "Successfully unmounted $mount_point"
  else
    echo "Failed to unmount $mount_point"
  fi
done