I’ve 2 network drives on one subnet (nfs and samba). I would like to access them only if computer is connected to particular ssid (subnet).

I’m using gnome primarily. And files stops responding if mount points can’t be accessed. There is no real way to recover from this apart from connecting to network, unmount and then change network.

I would like those drives to be accessed by system only if they are reachable.

      • exu@feditown.com
        link
        fedilink
        English
        arrow-up
        1
        ·
        16 hours ago

        Imagine using a well designed set of tools instead of parts stuck in the 90s

      • dustycups@aussie.zone
        link
        fedilink
        arrow-up
        4
        ·
        23 hours ago

        If you have systemd installed then using it is fine.
        Genuine question: what init do you use & how would you do this? Of course it doesn’t need to involve init.

        • caseyweederman@lemmy.ca
          link
          fedilink
          arrow-up
          6
          ·
          19 hours ago

          They just reach into their computer case and tickle the pins on the CPU when they want to initialize PID 1.

  • d00phy@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    1 day ago

    I know autofs will work with nfs. Never used it with SMB. I’ve used it on a share of /home to specifically mount /home/user as needed (e.g., at login).

    • corsicanguppy@lemmy.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 day ago

      I’ve used smb with autofs. Works a treat.

      Be sure you have nothing running from or accessing the mount constantly, of course – I forgot with a homedir – or it’ll never I mount.

  • stupid_asshole69 [none/use name]@hexbear.net
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 day ago

    When using gnome you’re supposed to not have specific filesystems mounted if they’re not gonna be available.

    The proscribed solution is to use systemd to figure out if those mount points are available and mount them, but that would have to be coming off networkd instead of fstab which it sounds like is what you’re using.

    A script to figure out if the server you want is available before mounting the filesystem would be easy, but a bad idea because that should be handled by your init system (probably systemd as above).

    You could also just abandon gnome and use something else.

    • rando@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      1 day ago

      Not really tied to gnome, it’s just something I’m using. Would KDE work better ?

      • stupid_asshole69 [none/use name]@hexbear.net
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        You’re asking the wrong person, I use lxqt.

        Tonight I can see if konqueror (the kde file browser still think…) does the same thing.

        How are your network filesystems mounted, fstab?

        • rando@lemmy.mlOP
          link
          fedilink
          arrow-up
          1
          ·
          6 hours ago

          just tried Dolphin (KDE file manager) - same experience. Going to experiment with autofs next

          • stupid_asshole69 [none/use name]@hexbear.net
            link
            fedilink
            English
            arrow-up
            2
            ·
            4 hours ago

            Man that makes me feel old, apparently konqueror was the kde web browser!

            So if I access a smb network share in pcmanfm-qt then switch networks my cursor turns into the watch when I try to click stuff in the share but nothing is hung or stuck and I can just click off it and even unmount using the eject icon beside the share name.

            This is using Debian 13 with lxqt.

        • rando@lemmy.mlOP
          link
          fedilink
          arrow-up
          1
          ·
          24 hours ago

          It was through fstab until recently. About 2 weeks back I moved to mount them on demand (systemd, will confirm exact method when I’m in front of computer) however this still doesn’t address unmount part when I switch network.