scripts: Remove sessionclean

We don't need to kill Emacs daemon, emacsclient can recover a broken socket with
the '-a ""' argument.

Trapping kill-emacs is also a bad idea when used with broken login managers like
LightDM: it may kill emacs unexpectedly.
master
Pierre Neidhardt 2017-06-29 16:13:36 +01:00
parent 3b464be913
commit 4f42076912
3 changed files with 3 additions and 23 deletions

View File

@ -100,7 +100,7 @@ export TIME_STYLE=+"|%Y-%m-%d %H:%M:%S|"
if command -v ssh-agent >/dev/null 2>&1 && [ -z "$SSH_AGENT_PID" ]; then
eval "$(ssh-agent)"
## Kill ssh-agent on session end. Console login only.
command -v sessionclean >/dev/null 2>&1 && trap 'sessionclean' 0
trap 'test -n "$SSH_AGENT_PID" && eval $(ssh-agent -k)' 0
fi
## Linux specific

View File

@ -1,21 +0,0 @@
#!/bin/sh
if [ "$1" = "-h" ]; then
cat <<EOF>&2
Usage: ${0##*/}
Clean various running processes. Run it before exiting a session.
EOF
exit
fi
if command -v emacsclient >/dev/null 2>&1; then
if emacsclient -e '(kill-emacs)' >/dev/null 2>&1; then
echo >&2 "Emacs terminated."
fi
fi
if [ -S "$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent -k)"
echo >&2 "SSH agent terminated."
fi

View File

@ -27,4 +27,5 @@ fi
## could be the place where to clean everything, but it will not be parsed by
## some login managers. Beside, systemd sessions may sigkill all user apps on
## logoff, preventing a clean termination.
# command -v sessionclean >/dev/null 2>&1 && sessionclean
# ssh-agent -k
## See if exec'ing "ssh-agent <WM>" is a better idea.