Hi,
Ansgar Burchardt writes:
> emacs26 added support for systemd socket activation (which I'm looking
> forward to use).
I was asked on IRC to test this with the Debian package (1:26.1+1-2).
It works:
After starting the emacs.socket unit, systemd opens the socket:
+---
| [...] /run/user/[...]/emacs [...] users:(("systemd",pid=2375,fd=23))
+---[ `ss -lxp | grep emacs` ]
Running `emacsclient` then starts `emacs` and the socket is passed to
emacs:
+---
| [...] /run/user/[...]/emacs [...]
users:(("emacs",pid=12153,fd=3),("systemd",pid=2375,fd=23))
+---[ `ss -lxp | grep emacs` ]
I've attached the .socket and .service units I'm using as someone was
asking for them (enable only emacs.socket to start emacs on demand); I
also have a wrapper script `e` which calls `emacsclient` with the
`--socket-name=${XDG_RUNTIME_DIR}/emacs` option (this would probably
also be safe to use by default if XDG_RUNTIME_DIR is set).
Ansgar
[Unit]
Description=GNU Emacs (Server)
Documentation=man:emacs(1)
Requires=emacs.socket
[Service]
ExecStart=/usr/bin/emacs --fg-daemon
ExecStop=/usr/bin/emacsclient --socket-name=%t/emacs --eval "(kill-emacs 0)"
Restart=always
Environment=GTK_IM_MODULE=xim
Environment="XMODIFIERS=@im=ibus"
Environment=CLUTTER_IM_MODULE=xim
Environment=GPG_AGENT_INFO=%t/keyring/gpg:0:1
[Install]
WantedBy=default.target
[Unit]
Description=GNU Emacs (Server)
Documentation=man:emacs(1) man:emacsclient(1)
[Socket]
ListenStream=%t/emacs
SocketMode=0600
[Install]
WantedBy=sockets.target