<div dir="ltr">Hi,<br><br>I am trying to write an upstart script that will start and gracefully shutdown emacs with my system. However, initctl stop emacs does not work.<br><br>Basically, when I run initctl stop emacs:<br>
<br>dmesg only shows <br>    [ 4363.589893] init: emacs goal changed from stop to start<br><br>on ctrl-c of initctl stop emacs, ps aux | grep emacs shows<br>    eric     13008 14.5  0.0 291228 29200 ?        Ssl  23:46   0:01 /usr/bin/emacs --daemon -u eric<br>
<br>indicating that it never killed the daemon<br><br>However, if I kill the daemon by sending SIGTERM or by running emacsclient -n -e '(kill-emacs)', then dmesg shows<br><br>[ 4378.169286] init: emacs state changed from spawned to stopping
<br>[ 4378.169314] init: event_new: Pending stopping event
<br>[ 4378.169325] init: Handling stopping event
<br>[ 4378.169392] init: event_finished: Finished stopping event
<br>[ 4378.169399] init: emacs state changed from stopping to killed
<br>[ 4378.169431] init: emacs state changed from killed to post-stop
<br>[ 4378.169450] init: emacs state changed from post-stop to waiting
<br>[ 4378.169473] init: event_new: Pending stopped event
<br>[ 4378.169484] init: job_change_state: Destroyed inactive instance emacs
<br>[ 4378.169542] init: Handling stopped event
<br>[ 4378.169594] init: event_finished: Finished stopped event<br><br>It's important to me that I run code in pre-stop to save my emacs buffers, and obvs. that isn't working either.<br><br>How can I fix this?<br>
<br><br>I've posted the details of problem here: <a href="http://askubuntu.com/questions/353288/upstart-not-starting-emacs-daemon">http://askubuntu.com/questions/353288/upstart-not-starting-emacs-daemon</a><br><br>Thanks,<br>
Eric<br>
</div>