From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Florian Schmaus Newsgroups: gmane.emacs.devel Subject: Set known success exit status in emacs.service Date: Thu, 2 Jan 2020 12:40:45 +0100 Message-ID: <978f5fbd-bc48-4489-baef-3c122ad82c8c@geekplace.eu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C6B46CB960D1C1C7D62EF7F5" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="121825"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 02 12:41:02 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1imyqc-000VWv-PD for ged-emacs-devel@m.gmane.org; Thu, 02 Jan 2020 12:41:02 +0100 Original-Received: from localhost ([::1]:40054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imyqb-0003JA-K4 for ged-emacs-devel@m.gmane.org; Thu, 02 Jan 2020 06:41:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45702) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imyqU-0003J3-FM for emacs-devel@gnu.org; Thu, 02 Jan 2020 06:40:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imyqP-0007NV-9Y for emacs-devel@gnu.org; Thu, 02 Jan 2020 06:40:54 -0500 Original-Received: from mail-wm1-f42.google.com ([209.85.128.42]:50276) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1imyqP-0007N7-2Z for emacs-devel@gnu.org; Thu, 02 Jan 2020 06:40:49 -0500 Original-Received: by mail-wm1-f42.google.com with SMTP id a5so5341934wmb.0 for ; Thu, 02 Jan 2020 03:40:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=4VlKhwL7Rt68AUQ67zY7QqvHzJ7Tne2Cfc7QlOVqBgI=; b=fGRfN4RNho6tTW+SLvUdMK8bd+Z/2L6fS3mGhPpuZCa1dwsfDRd6qM1Z9qaOlOoNp0 KI2nnHGws0/RYGQW+zsAQbusfoVo7wqH2eVKrfrAWjskL5nXNBNnmFliXiDLcQQS7V7B 6JFlENuzaHa4BR1vMcJxEEnF/CfqZtS1teiArDqjVIlFsYNcdmdsQwwGSi+L+8z8BEqM TPXt7oxphIwfeJN+P3vOBjvlP5enIQ44JSqva7eMu6vF+SGRNMLtF+Nkbb3zgeqXwh7s fHMJjSIRMR8p1W0JT0SmFWDUyP0cFMG4I+BShE3Opyb0yICVB+AUsNMtvCx0Dx6X4Nql epiw== X-Gm-Message-State: APjAAAU13CMQk5JebCqZlCbcOqeFkQxOxs9BaERo+UdQklB7a0n13hp6 t2SpvccNzYC4YO3xNAO8mAoJtzC1Ql4= X-Google-Smtp-Source: APXvYqzSRPqBDIs5ro8hyBxLje3Hp3WkRSmQyJnNL2PVgpOXzI6MAPN1TU7jdEzDGRDgHh58Ulim0g== X-Received: by 2002:a1c:a949:: with SMTP id s70mr13879775wme.69.1577965247002; Thu, 02 Jan 2020 03:40:47 -0800 (PST) Original-Received: from neo-pc.sch (55d4bbef.access.ecotel.net. [85.212.187.239]) by smtp.gmail.com with ESMTPSA id z11sm56065005wrt.82.2020.01.02.03.40.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jan 2020 03:40:46 -0800 (PST) Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.42 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243858 Archived-At: This is a multi-part message in MIME format. --------------C6B46CB960D1C1C7D62EF7F5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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 --------------C6B46CB960D1C1C7D62EF7F5 Content-Type: text/x-patch; charset=UTF-8; name="0001-Set-known-success-exit-status-in-emacs.service.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Set-known-success-exit-status-in-emacs.service.patch" >From 1f767a005dc55ac669f0dc400ca1e98ecd43ede5 Mon Sep 17 00:00:00 2001 From: Florian Schmaus 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 --------------C6B46CB960D1C1C7D62EF7F5--