* upstart script for emacs daemon
@ 2011-08-06 16:14 Eric Abrahamsen
0 siblings, 0 replies; only message in thread
From: Eric Abrahamsen @ 2011-08-06 16:14 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-06 16:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-06 16:14 upstart script for emacs daemon Eric Abrahamsen
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).