Hi Decklin,

On Tue, Sep 08, 2009 at 08:23:59AM -0400, Decklin Foster wrote:
> Excerpts from Florian Forster's message of Tue Sep 08 02:20:24 -0400 2009:
> > The value of “START_MPD” should not effect the shutdown behavior.
> > Otherwise mpd may not be shut down gracefully when the system is
> > stopped.
> 
> I'm not sure exactly what you want this to do. Are you starting MPD at
> some point after boot as it is configured in the package, or are you
> running it from a user account?

mpd was started when I bootet the machine. I noticed that and didn't
like it. So I edited “/etc/default/mpd” and then tried to stop the
daemon using the init script. This does not work, because the variable
“START_MPD” is evaluated even when the init script is supposed to stop
the daemon.

I guess it's not a big issue for mpd, but it *might* lose data or leave
behind a socket or something if it doesn't react to the SIGTERM sent
upon system shutdown quickly enough.

Apparently not all init scripts behave the same way: “/etc/init.d/snmpd”
from the “snmpd” package behaves the way I suggest / recommend,
“/etc/init.d/saned” from the “sane-utils” behaves as mpd's script.

> What is the issue with starting mpd on boot? It seems like if we can
> fix that, the root of the problem would be solved.

I seldom use the daemon and therefore prefer to start it when I need it,
that's all …

> The init system just runs the script. If there's a proper way to
> detect "by hand" invocation I am unaware of it.

You can check if the invoking shell is “interactive” by evaluating the
“PS1” environment variable. I've now added the following to the defaults
file to achieve the desired behavior:
-- 8< --
  START_MPD=false
  if test "x$PS1" != ""
  then
    START_MPD=true
  fi
-- >8 --

This (differentiating) behavior is just a suggestion. If you don't like
it or it violates some policy, don't worry about it – I'm perfectly
happy with this hacked version.

Regards,
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/

Attachment: signature.asc
Description: Digital signature

Reply via email to