My current work workflow includes using PuTTY to SSH into a Linux development box with many users. I use an Emacs daemon to avoid the long startup times when closing my Emacs sessions. However, the Emacs daemon dies upon ending my SSH session. I was wondering if there is a way to spawn the daemon such that it persists beyond closing the SSH session? The only solution I have seen thus far is to use Emacs inside Tmux, however I much prefer the GUI Emacs.
Fleshing out the suggestion of @Danh to use systemd
Recent emacs has improved it's support for emacs as a service. This includes
- the new fg-daemon option
- an accompanying systemd service file
[You are using an earlier emacs that does not have
In that case you must use
type=forking. That requires also
PIDFile=. AFAIK old Emacs doesn't provide this but here's a hack.
Allowing systemd to guess the pid works sometimes but is not recommended by systemd and should be treated as broken by default.