all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#31498: [PATCH] Notify systemd in daemon-initialized
@ 2018-05-18 17:40 Lucas Werkmeister
  2018-06-07 13:08 ` Noam Postavsky
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Lucas Werkmeister @ 2018-05-18 17:40 UTC (permalink / raw)
  To: 31498; +Cc: Lucas Werkmeister

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.
* etc/emacs.service: update Type
* src/emacs.c (daemon-initialized): call sd_notify()
---
 etc/emacs.service | 2 +-
 src/emacs.c       | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/etc/emacs.service b/etc/emacs.service
index b29177b120..dbcb6bc301 100644
--- a/etc/emacs.service
+++ b/etc/emacs.service
@@ -7,7 +7,7 @@ Description=Emacs text editor
 Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
 
 [Service]
-Type=simple
+Type=notify
 ExecStart=emacs --fg-daemon
 ExecStop=emacsclient --eval "(kill-emacs)"
 Environment=SSH_AUTH_SOCK=%t/keyring/ssh
diff --git a/src/emacs.c b/src/emacs.c
index f25e612664..8718b301a4 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2477,6 +2477,13 @@ from the parent process and its tty file descriptors.  */)
     error ("This function can only be called after loading the init files");
 #ifndef WINDOWSNT
 
+  if (daemon_type == 1)
+    {
+#ifdef HAVE_LIBSYSTEMD
+      sd_notify(0, "READY=1");
+#endif /* HAVE_LIBSYSTEMD */
+    }
+
   if (daemon_type == 2)
     {
       int nfd;
-- 
2.17.0






^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-07-26  1:13 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-18 17:40 bug#31498: [PATCH] Notify systemd in daemon-initialized Lucas Werkmeister
2018-06-07 13:08 ` Noam Postavsky
2018-06-07 15:38   ` Eli Zaretskii
2018-06-07 21:40   ` Lucas Werkmeister
2018-06-08  0:41     ` Noam Postavsky
2018-06-09 10:27 ` bug#31498: [PATCH] Notify systemd in daemon-initialized and kill-emacs Lucas Werkmeister
2018-06-09 10:55 ` bug#31498: (no subject) Lucas Werkmeister
2018-06-09 10:56 ` bug#31498: [PATCH] Notify systemd in daemon-initialized and kill-emacs Lucas Werkmeister
2018-06-09 12:29   ` Noam Postavsky
2018-06-09 12:31     ` Lucas Werkmeister
2018-06-09 12:36     ` Noam Postavsky
2018-06-09 13:00       ` Lucas Werkmeister
2018-06-09 14:05         ` Noam Postavsky
2018-06-13 13:42           ` Lucas Werkmeister
2018-06-13 16:33             ` Eli Zaretskii
2018-06-09 13:01 ` Lucas Werkmeister
2018-07-12 22:20 ` bug#31498: [PATCH] Notify systemd in daemon-initialized and, kill-emacs Lucas Werkmeister
2018-07-13  6:58   ` Eli Zaretskii
2018-07-25 12:03 ` bug#31498: [PATCH] Notify systemd in daemon-initialized and, , kill-emacs Lucas Werkmeister
2018-07-25 14:48   ` Eli Zaretskii
2018-07-26  1:13     ` Noam Postavsky

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.