This is what I use to automount a directory on my desktop via sshfs on my Mac. It's a pretty dirty script that I wrote before I knew a bit more about scripting, so I have to clean it up. I have dual outcomes when they're not necessary. Why not just use a shell script? It works great in my situation.
Code:
# startup_actions (Automator action-"Run Shell Script")
# Wait 5 seconds for WiFi to come up
sleep 5
if /sbin/ifconfig | grep 192.168 > /dev/null # Test for network connection anyway
then
# Mount /home/ninjasb@starbox via sshfs
mkdir /Volumes/starbox_ninjasb
if /sbin/ifconfig | /usr/bin/grep 192.168.2 > /dev/null
then
/usr/local/bin/sshfs ninjasb@192.168.2.4:/home/ninjasb /Volumes/starbox_ninjasb -oreconnect,volname=starbox_ninjasb
else
/usr/local/bin/sshfs ninjasb@XX.XX.XX.XX:/home/ninjasb /Volumes/starbox_ninjasb -oreconnect,volname=starbox_ninjasb
fi
sleep 1; /opt/local/bin/mpd # Wait 1 second for sshfs mount to settle, then start mpd
fi
__________________
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity."
MacBook Pro (Darwin 9), iMac (Darwin 9), iPod Touch (Darwin 9), Dell Optiplex GX620 (FreeBSD 7.1-STABLE)
Last edited by ninjatux; 30th July 2008 at 03:46 AM.
|