From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: upstart script for emacs daemon
Date: Sat, 06 Aug 2011 09:14:00 -0700 [thread overview]
Message-ID: <87k4aq8qlz.fsf@ericabrahamsen.net> (raw)
I'm trying to write an upstart[fn:1] script to have emacs start as a
daemon and shut down upon logout. This seems like a good idea as upstart
has more flexibility than the traditional sysvinit method of running
jobs.
Starting the daemon after login seems easy enough, but I have a question
about stopping it automatically. Upstart scripts can have a "pre-stop"
stanza[fn:2], which is run before SIGTERM is sent to your process.
My question is, is SIGTERM the same signal that is sent upon calling
(save-buffers-kill-terminal/emacs)? The only thing that needs doing
before the emacs daemon is killed is making sure all unsaved buffers are
saved (without user interaction). Should I do that in a kill-emacs-hook,
confident that the SIGTERM signal will allow that hook to run? Or do it
in the "pre-stop" stanza of the upstart script, for instance:
"exec emacsclient -e "(save-some-buffers t)""
to only save the buffers, and then let upstart actually kill the
process?
Hmm, hope that's clear. Any pointers would be welcome! If I put
something respectable together I'll add it to the wiki[fn:3]
Thanks!
Eric
Footnotes:
[fn:1] http://en.wikipedia.org/wiki/Upstart
[fn:2] http://upstart.ubuntu.com/cookbook/#pre-stop
[fn:3] http://www.emacswiki.org/emacs/EmacsAsDaemon
reply other threads:[~2011-08-06 16:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k4aq8qlz.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).