Page 9 of 14 FirstFirst ... 7891011 ... LastLast
Results 81 to 90 of 139

Thread: SSHFS AUTOmount on Feisty

  1. #81
    Join Date
    Apr 2009
    Beans
    15

    Re: SSHFS AUTOmount on Feisty

    This tutorial has been extremely useful for me. However, my system doesn't seem to be calling the /etc/network/ip-up.d and /etc/network/if-down.d scripts. I can now mount my folder without a password, and can call the if-up.d or if-down.d scripts from the command line just fine. But there is no automatic mount when I log in, and no automatic unmount when I kill the network collection (e.g., by manually disconnecting my wifi, which I've just done as a test).

    Can anyone please clarify when the scripts in if-up.d and if-down.d are called by the system?

  2. #82
    Join Date
    Feb 2007
    Beans
    77

    Re: SSHFS AUTOmount on Feisty

    Quote Originally Posted by olembe View Post
    This tutorial has been extremely useful for me. However, my system doesn't seem to be calling the /etc/network/ip-up.d and /etc/network/if-down.d scripts. I can now mount my folder without a password, and can call the if-up.d or if-down.d scripts from the command line just fine. But there is no automatic mount when I log in, and no automatic unmount when I kill the network collection (e.g., by manually disconnecting my wifi, which I've just done as a test).

    Can anyone please clarify when the scripts in if-up.d and if-down.d are called by the system?
    The scripts in the directory /etc/network/if-up.d should be run right after a network connection is established. Likewise, the scripts in /etc/network/if-down.d should be right right before a connection is terminated.

  3. #83
    Join Date
    Apr 2009
    Beans
    15

    Re: SSHFS AUTOmount on Feisty

    Thanks for the quick reply, D.A.W.

    It doesn't seem to be working. I've used the scripts from this tutorial, but the directory doesn't automount when I boot up, and doesn't disconnect automatically when I lose the network connection. The permissions all seem right (the .d directories and the scripts inside are owned by root), so I'm mystified.

  4. #84
    Join Date
    Feb 2007
    Beans
    77

    Re: SSHFS AUTOmount on Feisty

    Did you make sure to mark the scripts executable?

    You can test things by makeing some scripts in those directories called 50-test-script.sh with the following contents:

    date >> /tmp/if-test.log
    echo "Interface came up/down." >> /tmp/if-test.log

    Then check the file /tmp/if-test.log while you connect and disconnect your network. It should have new lines of text appended each time. If not, then the scripts are definitely not being executed. You can monitor this file in real time by running the following command in a terminal:

    tail -f /tmp/if-test.log

  5. #85
    Join Date
    Apr 2009
    Beans
    15

    Re: SSHFS AUTOmount on Feisty

    Quote Originally Posted by Darwin Award Winner View Post
    Did you make sure to mark the scripts executable?
    Yes, they're 755.

    Quote Originally Posted by Darwin Award Winner View Post
    You can test things by makeing some scripts in those directories called 50-test-script.sh with the following contents:

    date >> /tmp/if-test.log
    echo "Interface came up/down." >> /tmp/if-test.log

    Then check the file /tmp/if-test.log while you connect and disconnect your network. It should have new lines of text appended each time. If not, then the scripts are definitely not being executed. You can monitor this file in real time by running the following command in a terminal:

    tail -f /tmp/if-test.log
    Good suggestion. I tried that and disconnected, then reconnected, my wifi connection. Nothing went into the file. Do I need to do something more dramatic than kill my wifi connection? Or is that now evidence the scripts aren't being called?

  6. #86
    Join Date
    Feb 2007
    Beans
    77

    Re: SSHFS AUTOmount on Feisty

    The default Ubuntu configuration executes these scripts at the appropriate times. I haven't messed around with it lately, but if I recall correctly, the component responsible for executing the scripts is Newtork Manager. Have you switched to wicd or some other network configuration system?

  7. #87
    Join Date
    Apr 2009
    Beans
    15

    Re: SSHFS AUTOmount on Feisty

    Ah! Yes, I'm using wicd. Sorry: I should have mentioned that. Right: that explains it.

    I've just had a hunt and found http://ubuntuforums.org/archive/index.php/t-905131.html which mentions scripts. This solved it.

    For the benefit of anyone else: From the wicd window (the one which lists available networks), click the little triangle next to your wireless network name to see extra options. One of these is a button called 'scripts'. Here, you can choose scripts to run before and after connection, and after disconnection.

    I entered the paths to my if-up.d and if-down.d scripts here and it solved everything!

    Thanks so much for the help.

    (Incidentally, I decided to leave the scripts in the if-up.d and if-down.d directories, so it's all set if I switch back to network manager in the future)
    Last edited by olembe; July 31st, 2009 at 03:12 PM.

  8. #88
    Join Date
    Aug 2008
    Location
    Seattle, WA
    Beans
    11

    Re: SSHFS AUTOmount on Feisty

    Thanks for the outstanding script. One suggestion for unmounting the shares from:
    Code:
    for mount in $mounted; do umount -l $mount; done;
    to
    Code:
    for mount in $mounted; do fusermount -uq $mount; done;
    mountsshfs works if called by root or user, but umountsshfs doesn't as umount returns an error if not called by root.

  9. #89
    Join Date
    Feb 2007
    Beans
    77

    Re: SSHFS AUTOmount on Feisty

    Yes, I need to update this setup. I had been meaning to set up a solution that used gvfs (GNOME Virtual File System) instead of sshfs, but the gvfs implementation of sftp has not worked consistently for me. However, I've recently found out about autossh, which can be combined with sshfs for more persistent mounts. I plan to update this script in the next few weeks.

  10. #90
    Join Date
    Jun 2006
    Location
    Parma, Italy
    Beans
    679
    Distro
    Kubuntu

    Re: SSHFS AUTOmount on Feisty

    Please, don't tie it to a desktop environment. I am using your scripts on kubuntu netbooks, where all hard disk space is at a premium and every added lib might be one too many...

    autossh migh be a good idea...

Page 9 of 14 FirstFirst ... 7891011 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •