tygernach: (tyger! tyger!)
[personal profile] tygernach

Хозяйке на заметку – легче переносить сабжевую проблему, кажется, помогает рецепт по ссылке
На всякий случай дублирую рецепт под катом.

To keep ssh sessions alive even with the client suspended you could increase ‘ClientAliveInterval’ in /etc/ssh/sshd_config on the remote side, for example to 600 minutes. Because now sessions stay open on the server you need to prevent ending up with dozens of sessions, so put this in ~/.ssh/config on the client to reuse sessions instead of creating new ones:
# prevent connection from hanging
ServerAliveInterval 15
# set connection sharing
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p

Eventually sessions will die and so this is a way to make sure sshfs unmounts and mounts when suspending:
( For mounts done as non-root user you would need to change the line with starting with fusermount to something like: su -c ‘fusermount -u ..’ otherusername)
/etc/pm/sleep.d/00_sshfs_automount.sh:


           #!/bin/bash
                # unmount all sshfs mountpoints before suspending/hibernating
                # to prevent hanging sshfs after resume/thaw
                case $1 in
                hibernate | suspend)
                    mountpoint_count=$(egrep -c '(/[^ ]+) fuse.sshfs' /etc/mtab)
                    if [ $mountpoint_count -gt 0 ]; then
                        mountpoints=($(awk '/(\/[^ ]+) fuse.sshfs/ { print $2 }' /etc/mtab))
                        for element in  $(seq 0 $((${#mountpoints[@]} - 1)))
                        do
                            fusermount -u "${mountpoints[$element]}"
                        done
                    fi
                    ;;
                thaw | resume )
                    mount -a
                    ;;
                #   exit 0
                #   ;;
                esac
            exit 0

Mirrored from TygerSpace.

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

tygernach: (Default)
tygernach

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526 272829
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 20th, 2025 07:05 pm
Powered by Dreamwidth Studios