Skip site navigation (1) Skip section navigation (2)

Re: Linux start script updates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Linux start script updates
Date: 2010-03-01 16:31:18
Message-ID: 18267.1267461078@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> I can't see a clear case either way.  I know I *have* seen scripts
> which took the trouble to special-case it, but I just poked around
> and found that it seems much less common than unconditionally using
> "exit 5".  Does anyone know of an environment where it matters?

Probably not.  You might find it entertaining to read the current
Fedora guidelines for init scripts:

https://fedoraproject.org/wiki/Packaging:SysVInitScript

The skeleton shown there only bothers to throw exit 5 when the
program is missing at start time.

I think though that the answer to Peter's question is that "stop" has to
be special cased to some extent, because it is not supposed to be an
error to stop a service that's not running.  If it's not even installed,
then a fortiori it's not running, so the exit code *must* be 0 not 5 in
that case.  I've even been told that you should get 0 if you run
"service foo stop" on a non-running service as a non-superuser,
ie, a case where you *would* get a failure (no permissions) if the
service were running.  I'm not sure I believe that last bit myself,
but Red Hat has got some test scripts that think this.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2010-03-01 16:32:24
Subject: Re: contrib/xml2 regression tests vs no-libxslt build option
Previous:From: Robert HaasDate: 2010-03-01 16:30:04
Subject: Re: Re: pgsql: add EPERM to the list of return codes to expect from opening

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group