Problem with initctl stop

Steve Langasek steve.langasek at ubuntu.com
Fri Oct 4 04:50:13 UTC 2013


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20131003/056f919e/attachment.pgp>


More information about the upstart-devel mailing list