#!/bin/bash

# stop automount processes

# get the list of all currently mounted shares from df

SHARE_LIST=`df | grep automount | awk '{print $8}'`
PID_LIST=`ps -aux | grep automount | awk '{print $2}'`

# umount shares, then kill pid's

for sharedir in ${SHARE_LIST}
do
    echo "Attempting to umount share: ${sharedir}"
    umount ${sharedir}
done

for pid in ${PID_LIST}
do
    echo "Killing process ${pid}."
    kill ${pid}
done

