![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Хозяйке на заметку – легче переносить сабжевую проблему, кажется, помогает рецепт по ссылке
На всякий случай дублирую рецепт под катом.
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.