Originally Posted by
Darwin Award Winner
The mountnfs scripts make the same assumption that my script does, i.e. that the servers that it connects to are always on (you could call this the client assumption), so there's nothing about those scripts that would guarantee that the shares were mounted whenever both ends were on.
Here's what I have for now:
Server /etc/network/if-up.d/sshfsmount:
Code:
#!/bin/bash
fusermount -uz "/home/serverusername/Music/Remote CD-ROM/"
sshfs username@laptophostname:"/media/cdrom" "/home/serverusername/Music/Remote CD-ROM"
fusermount -uz "/home/serverusername/Music/Remote My Music"
sshfs username@laptophostname:"/media/windows/Documents and Settings/Username/My Documents/My Music" "/home/serverusername/Music/Remote My Music"
fusermount -uz "/home/serverusername/Music/FTP music/"
sshfs username@laptophostname:"/home/ftp" "/home/serverusername/Music/FTP music"
Laptop /etc/network/if-up.d/sshfsmount:
Code:
#!/bin/bash
sudo -u username ssh serverhostname '
bash /etc/network/if-up.d/sshfsmount
'
That way if the server comes up and the laptop is already on, it mounts the laptop's shares. If the laptop comes up and the server is already up, it asks the server to mount the shares, and I only have to edit the shares list in one place.
I seem to recall someone else's solution which included a script that pinged all the servers every 5 minutes or so and mounted or unmounted the shares based on whether the ping succeeded. You could try searching for that.
That's a good idea. I can't find it, though.
Bookmarks