Script to mount SMB share
Hello all,
I am trying to write a script to mount an SMB share to a user's folder when they log in to one of the Mac clients. My script is working for the most part, but sometimes when it is run the folder on the desktop disappears. If I navigate to the Desktop folder in Finder, it is there.
I have been searching here and other websites on the internet but I haven't been able to find an answer to this problem. I am hoping someone might have an idea. The script is below.
#!/bin/bash
cur_user=`/bin/ls -l /dev/console | awk '/ / { print $3 }'`
if [ ! -d /Users/$cur_user/Desktop/Home ]
then
mkdir /Users/$cur_user/Desktop/Home
else
mount -t smbfs //10.210.0.13/staff/$cur_user /Users/$cur_user/Desktop/Home
fi
exit 0
MacBook Pro, OS X Mountain Lion (10.8)