1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-15 09:47:20 +00:00
Commit Graph

8 Commits

Author SHA1 Message Date
Tim Ruffing
e5348f125f * etc/emacs.service:
* etc/emacs.service (ExecStart): Make Emacs exit from systemd work
better (bug#45181).

The problem here is the exit code 15, which emacs will return *only* if
it has received SIGTERM. I believe what's happening here is that
emacsclient will call kill-emacs but not wait until the emacs server
has properly shut down. However, it's supposed to wait for the shutdown
as an "ExecStop" command according to "man systemd.service". So since
the process is still alive when emacsclient comes back, systemd will
still issue SIGTERM, making emacs return 15 (maybe after calling kill-
emacs again?!).

Copyright-paperwork-exempt: yes
2020-12-14 17:59:58 +01:00
Lars Ingebrigtsen
45cb0403de Partially revert previous patch to emacs.service
* etc/emacs.service (ExecStop): Partially revert previous patch
for bug#37847, since: "This appears to break packages that rely on
`invocation-name' to be executable."
2020-10-13 05:48:13 +02:00
Carlos Pita
1a845a672d Improve client/daemon xdg/systemd experience
* Makefile.in: Add emacsclient.desktop generation.
* etc/emacsclient.desktop: Add file, use emacsd as StartupWMClass.
* etc/emacs.service: Run with name emacsd (bug#37847).
2020-08-09 15:57:51 +02:00
Lars Ingebrigtsen
ca08815943 Don't override SSH_AUTH_SOCK in the example emacs.service file
* etc/emacs.service (ExecStop): Don't override SSH_AUTH_SOCK by
default, because it varies by distribution where the socket is
(bug#27620).
2019-07-21 17:11:59 +02:00
Lucas Werkmeister
19f5f7b19b Notify systemd in daemon-initialized and kill-emacs (Bug#31498)
With --[bg-]daemon and Type=forking, systemd will only consider the
daemon to have fully started up once the original process exits, and
will wait until then to start units depending on the Emacs service.  To
get the same functionality with --fg-daemon, use Type=notify instead of
Type=simple and explicitly send a readiness notification to systemd at
the point where the forked process would in --bg-daemon mode notify its
parent process and cause it to exit.  Similarly, notify systemd at the
beginning of the shutdown process as well.  (Both of these calls are
successful no-ops if emacs was not started by systemd.)
* etc/emacs.service: Update Type.
* src/emacs.c (daemon-initialized) [HAVE_LIBSYSTEMD]:
* src/emacs.c (kill-emacs) [HAVE_LIBSYSTEMD]: Call sd_notify().
2018-07-25 21:07:03 -04:00
Noam Postavsky
75b8492946 Rename '--new-daemon' to 'fg-daemon' and '--old-daemon' to '--bg-daemon'
* doc/emacs/cmdargs.texi (Initial Options):
* doc/lispref/os.texi (Startup Summary):
* etc/NEWS:
* etc/emacs.service:
* src/emacs.c (main):
* src/lisp.h: Rename '--new-daemon' to 'fg-daemon' and '--old-daemon' to
'--bg-daemon'.
2017-05-29 22:18:55 -04:00
Glenn Morris
36b99556de Add --new-daemon, which runs in the foreground and does not fork
This is intended for modern init systems such as systemd,
which manage many of the traditional aspects of daemon behavior
themselves.  (Bug#2677)
* src/emacs.c (daemon_type): New integer.
(usage, standard_args): Add --old-daemon and --new-daemon.
(main): Handle --old-daemon and --new-daemon arguments.
Restrict all the forking and complicated daemon stuff to old-daemon.
(Fdaemon_initialized): Handle new-style daemon.
* src/lisp.h (IS_DAEMON, DAEMON_RUNNING) [!WINDOWNT]:
Replace daemon_pipe with daemon_type.
* doc/emacs/cmdargs.texi (Initial Options):
* doc/emacs/glossary.texi (Glossary):
* doc/emacs/misc.texi (Emacs Server):
* doc/lispref/display.texi (Window Systems):
* doc/lispref/os.texi (Startup Summary): Related doc updates.
* etc/NEWS: Mention this.
* etc/emacs.service: Use Type=simple and --new-daemon.
2016-11-15 23:28:47 -08:00
Glenn Morris
181bd848eb Include a systemd user unit file. (Bug#16507)
* etc/emacs.service: New file.
* doc/emacs/misc.texi (Emacs Server): Mention systemcl --user.
* Makefile.in (libdir): New, set by configure.
(systemdunitdir): New variable.
(install-etc, uninstall): Handle the emacs.service file.
2016-11-13 15:46:31 -08:00