[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#60979: What /etc/init.d/xxx restart does?



On Wed, 11 Sep 2002, Bill Allombert wrote:
> I feel it is very important every init script behave the same. However the
> wording of section 10.3.2 is confusing:
> 
>    The init.d scripts should ensure that they will behave sensibly if invoked
>    with start when the service is already running, or with stop when it isn't,

That means starting an already started service is not an error, and that
stopping an already stopped one isn't an error either.

>        |running |not running|
>        ----------------------
> start  | error  |  start    |
> stop   | stop   |  error    |
> restart| restart|  start    |

No.  It is:
start   | return ok, do nothing |  start |
stop    | stop   | return ok, do nothing |
restart | run start, then run stop       |

So that means you always end up with the service started and no errors for
"restart", unless the service cannot be stopped/started for a real reason
(config problems, or whatever).

> Not that if restart is implemented as 
> /etc/init.d/xxx stop 
> /etc/init.d/xxx start
> it must disregard te exit status of the /etc/init.d/xxx stop.

No, unless stop is not properly implemented.  Stop should only fail if the
service is running, *and* cannot be stopped.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh



Reply to: