[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
upstart script for emacs daemon
From: |
Eric Abrahamsen |
Subject: |
upstart script for emacs daemon |
Date: |
Sat, 06 Aug 2011 09:14:00 -0700 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux) |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- upstart script for emacs daemon,
Eric Abrahamsen <=