Stop automatic remounting from locking automountd

This commit is contained in:
Thomas Lovén 2017-10-24 21:20:14 +02:00
parent fd71be60a0
commit b70317fa04

View File

@ -30,6 +30,7 @@ mounts="music photo video NAS"
# don't change below here unless you know what you are doing with shell scripts. # don't change below here unless you know what you are doing with shell scripts.
all_mounts=`/sbin/mount | /usr/bin/grep $t_mnt | /usr/bin/grep -v "map $autofsname on $t_mnt"` all_mounts=`/sbin/mount | /usr/bin/grep $t_mnt | /usr/bin/grep -v "map $autofsname on $t_mnt"`
d=`/bin/date` d=`/bin/date`
@ -43,6 +44,11 @@ do
mm=`/bin/echo "$all_mounts" | /usr/bin/grep $full_mount` mm=`/bin/echo "$all_mounts" | /usr/bin/grep $full_mount`
if [[ ! $mm =~ on.$full_mount.*mounted.by.$mnt_usr ]]; then if [[ ! $mm =~ on.$full_mount.*mounted.by.$mnt_usr ]]; then
echo "fix_mounts [$d] Remounting: $full_mount - because $mnt_usr not mounted $mm" echo "fix_mounts [$d] Remounting: $full_mount - because $mnt_usr not mounted $mm"
ps -e | grep automounted
if ps -e | grep automounted | grep -v grep; then
echo "Automount in progress. Aborting!"
exit 0
fi
/usr/bin/sudo /sbin/umount $full_mount /usr/bin/sudo /sbin/umount $full_mount
# if resource is busy force unmount with diskutil DANGER # if resource is busy force unmount with diskutil DANGER
if [ ! $? ]; then /usr/sbin/diskutil unmount force $full_mount; fi if [ ! $? ]; then /usr/sbin/diskutil unmount force $full_mount; fi