all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Set known success exit status in emacs.service
@ 2020-01-02 11:40 Florian Schmaus
  2020-01-02 11:53 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Schmaus @ 2020-01-02 11:40 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]

It appears that the emacs daemon will terminate with an exit code value
'15' once kill-emacs is invoked. If the daemon is run with the example
emacs.service systemd file from the source repository, then systemd
reports and records an unsuccessful exit:

systemd[4908]: Stopping Emacs text editor...
sh[415489]: Saving file /home/user/.emacs.d/recentf...
sh[415489]: Wrote /home/user/.emacs.d/recentf
systemd[4908]: emacs-26.service: Main process exited, code=exited,
  status=15/n/a
systemd[4908]: emacs-26.service: Failed with result 'exit-code'.
systemd[4908]: Stopped Emacs text editor.
systemd[4908]: emacs-26.service: Consumed 1.536s CPU time.

The applied patch adds

SuccessExitStatus=15

to the emacs.service file, which makes systemd recognize the exit as a
successful one.

As I was unable to find documentation about the exit codes of emacs, I
wonder if there are other exit codes besides 0 and 15 that should/could
be considered a successful exit, and hence, should be listed in the
example systemd service file SuccessExitStatus configuration?

- Florian

[-- Attachment #2: 0001-Set-known-success-exit-status-in-emacs.service.patch --]
[-- Type: text/x-patch, Size: 1149 bytes --]

From 1f767a005dc55ac669f0dc400ca1e98ecd43ede5 Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flo@geekplace.eu>
Date: Thu, 2 Jan 2020 12:26:07 +0100
Subject: [PATCH] Set known success exit status in emacs.service

As otherwise systemd will report and record an unsuccessful exit when
terminating the service:

systemd[4908]: Stopping Emacs text editor...
sh[415489]: Saving file /home/user/.emacs.d/recentf...
sh[415489]: Wrote /home/user/.emacs.d/recentf
systemd[4908]: emacs-26.service: Main process exited, code=exited, status=15/n/a
systemd[4908]: emacs-26.service: Failed with result 'exit-code'.
systemd[4908]: Stopped Emacs text editor.
systemd[4908]: emacs-26.service: Consumed 1.536s CPU time.
---
 etc/emacs.service | 1 +
 1 file changed, 1 insertion(+)

diff --git a/etc/emacs.service b/etc/emacs.service
index c99c6779f58..3d03801ba2b 100644
--- a/etc/emacs.service
+++ b/etc/emacs.service
@@ -14,6 +14,7 @@ ExecStop=emacsclient --eval "(kill-emacs)"
 # set it from PAM, so don't override by default.
 # Environment=SSH_AUTH_SOCK=%t/keyring/ssh
 Restart=on-failure
+SuccessExitStatus=15
 
 [Install]
 WantedBy=default.target
-- 
2.24.1


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

end of thread, other threads:[~2020-01-02 19:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-02 11:40 Set known success exit status in emacs.service Florian Schmaus
2020-01-02 11:53 ` Andreas Schwab
2020-01-02 19:45   ` Florian Schmaus

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.