#!/bin/bash echo "" echo "Command issued: "$0" "$@ echo "" if [ "${HOSTNAME:0:12}" != datamover ]; then echo "You can only use mmrmdir on the datamovers" echo exit fi if [ "$1" == "" ] || [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--h" ] || [ "$1" == "--help" ] || [ $# -gt 2 ] || [ "$1" == "-test" ]; then echo "Usage: mmrmdir [-test]" echo " -test to verify what will be deleted" echo exit fi if [ "$2" != "" ] && [ "$2" != "-test" ]; then echo "Usage: mmrmdir [-test]" echo " -test to verify what will be deleted" echo exit fi echo -n "You have 10 seconds to cancel:" for a in `seq 0 9`; do echo -n " $a" sleep 1; done echo " resuming ..." LOCATION=$1 slash=`echo $LOCATION | grep /` if [ "$slash" == "" ]; then echo "$LOCATION is not an absolute path" echo exit fi if [ "$2" == "-test" ]; then mmapplypolicy $LOCATION -P /usr/lpp/mmfs/bin/mmpolicyRules-DELETE-ALL -I test -L 2 else mmapplypolicy $LOCATION -P /usr/lpp/mmfs/bin/mmpolicyRules-DELETE-ALL -I defer -L 2 if [ "$?" != 0 ] then echo #### there was an error with mmapplypolicy execution #### else echo removing empty directories in $LOCATION rm -rf $LOCATION fi fi exit 0