You are not logged in.

#1 2006-06-02 16:17:34

sweiss
Member
Registered: 2004-02-16
Posts: 635

[script] smbfs-reset

I had this problem that when I was restarting my Windows machine, my smbfs shares were unusable and couldn't be easily remounted. So I made this little script which does it in a rather brutal, yet working way.

Hope you'll find it useful.

#!/bin/bash

# Make sure we are running under root
if [ ! `whoami` = "root" ]; then
  echo "You need root priviliges to run this script."
  exit
fi

# Gets the bad mount points
BAD_MOUNT_POINTS=`cat /etc/mtab | grep smbfs | awk ' {print $2} '`

# Delete the bad entries from /etc/mtab
sed -i '/^.* smbfs .*$/ d' /etc/mtab

# remount the bad mounts
for i in $BAD_MOUNT_POINTS; do
  umount -l $i
  mount $i
done

echo "Mounts were reset successfully."

Enjoy.

Offline

Board footer

Powered by FluxBB