Problem with initctl stop
Eric Huang
ehuang4 at gmail.com
Fri Oct 4 04:59:03 UTC 2013
Hi Steve,
Thanks for the quick reply.
I believe I properly set up my conf using expect daemon (I followed the
instructions on upstart for counting forks).
initctl status emacs
emacs start/spawned, process 19451
Maybe it's also worth pointing out that when I run initctl start emacs, it
spawns emacs correctly but hangs.
I know initctl is tracking the correct pid of emacs daemon because when I
kill the daemon externally, initctl recognizes that the process has died (I
provided output of that in the previous post).
For reference, here is my full script
# emacs --daemon - Emacs daemon
#
# The Emacs daemon provides a server for Emacs clients.
description "Emacs daemon"
start on runlevel [2345]
stop on runlevel [!2345]
expect daemon
#respawn
#respawn limit 10 5 # respawn up to 10 times, waiting 5 seconds each time
pre-start script
echo "Starting emacs daemon..." >> /home/eric/Desktop/emacs.log
end script
pre-stop script
echo "Killing emacs daemon..." >> /home/eric/Desktop/emacs.log
exec /usr/bin/sudo -u eric /usr/bin/emacsclient -n -e '(kill-emacs)'
end script
exec start-stop-daemon --start --chuid eric --exec /usr/bin/emacs --
--daemon -u eric
Thanks,
Eric
On Fri, Oct 4, 2013 at 12:50 AM, Steve Langasek
<steve.langasek at ubuntu.com>wrote:
> Hi Eric,
>
> On Fri, Oct 04, 2013 at 12:27:17AM -0400, Eric Huang wrote:
> > 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.
>
> > Basically, when I run initctl stop emacs:
>
> > dmesg only shows
> > [ 4363.589893] init: emacs goal changed from stop to start
>
> > on ctrl-c of initctl stop emacs, ps aux | grep emacs shows
> > eric 13008 14.5 0.0 291228 29200 ? Ssl 23:46 0:01 /usr/bin/emacs
> > --daemon -u eric
>
> > indicating that it never killed the daemon
>
> What does 'status emacs' show from the commandline? I believe you will
> find
> that, because emacs has daemonized (meaning the foreground process has
> exited), upstart assumes that the service has exited, and the running emacs
> process is not being tracked.
>
> Fixing this should be as simple as adding 'expect fork' to your upstart
> job,
> to let upstart know to expect emacs to detach from the foreground.
>
> Hope that helps,
> --
> Steve Langasek Give me a lever long enough and a Free OS
> Debian Developer to set it on, and I can move the world.
> Ubuntu Developer http://www.debian.org/
> slangasek at ubuntu.com vorlon at debian.org
>
> --
> upstart-devel mailing list
> upstart-devel at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/upstart-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20131004/81ed2d0c/attachment-0001.html>
More information about the upstart-devel
mailing list