aboutsummaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorLucas Werkmeister2018-06-09 15:01:08 +0200
committerNoam Postavsky2018-07-25 21:07:03 -0400
commit19f5f7b19b0dcdae87476a3fd51c41f840b2b80f (patch)
tree89706b7d4679fb70ca658ab474c469afef14333f /etc
parent244b6827257fb0ec9c14f19b9dd01a0e1bee1d75 (diff)
downloademacs-19f5f7b19b0dcdae87476a3fd51c41f840b2b80f.tar.gz
emacs-19f5f7b19b0dcdae87476a3fd51c41f840b2b80f.zip
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().
Diffstat (limited to 'etc')
-rw-r--r--etc/NEWS8
-rw-r--r--etc/emacs.service2
2 files changed, 9 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 21b648cbb4c..995ceb67b78 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -81,6 +81,14 @@ work right without some adjustment:
81- you can use the new 'package-quickstart' so activation of packages does not 81- you can use the new 'package-quickstart' so activation of packages does not
82 need to pay attention to 'package-load-list' or 'package-user-dir' any more. 82 need to pay attention to 'package-load-list' or 'package-user-dir' any more.
83 83
84---
85** Emacs now notifies systemd when startup finishes or shutdown begins.
86Units that are ordered after 'emacs.service' will only be started
87after Emacs has finished initialization and is ready for use.
88(If your Emacs is installed in a non-standard location and you copied the
89emacs.service file to eg ~/.config/systemd/user/, you will need to copy
90the new version of the file again.)
91
84 92
85* Changes in Emacs 27.1 93* Changes in Emacs 27.1
86 94
diff --git a/etc/emacs.service b/etc/emacs.service
index b29177b120c..dbcb6bc301e 100644
--- a/etc/emacs.service
+++ b/etc/emacs.service
@@ -7,7 +7,7 @@ Description=Emacs text editor
7Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ 7Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
8 8
9[Service] 9[Service]
10Type=simple 10Type=notify
11ExecStart=emacs --fg-daemon 11ExecStart=emacs --fg-daemon
12ExecStop=emacsclient --eval "(kill-emacs)" 12ExecStop=emacsclient --eval "(kill-emacs)"
13Environment=SSH_AUTH_SOCK=%t/keyring/ssh 13Environment=SSH_AUTH_SOCK=%t/keyring/ssh