initctl — utility to control simpleinit(8)
need
[−r
] service
display-services
provide
service
The initctl programme is designed to help improve the robustness, scalability and readability of system boot scripts. It is now possible to write a modularised set of boot scripts without the complex and fragile numbered symlink scheme used in SysV-style boot scripts. Each script can simply declare, using need(8), what must run before them.
The need
programme is a utility that tells simpleinit(8) to start a
service
(usually a
script in /sbin/init.d
) and
will wait for the service to become available. If the service
is already available, it will not be started again.
The −r
option is used to tell simpleinit(8) to "roll
back" (stop) services up to (but not including) service
. If service
is not specified, all
services are stopped. The −r
option thus allows the
system to be partially or wholly shut down in an orderly
fashion. The shutdown(8) programme still
needs to be run.
When invoked as display-services
it will
write the list of currently available services and the list
of failed services to the standard output.
When invoked as provide it tells simpleinit(8) that the
parent (calling) process will be providing a service with
name service
. If the
calling process exits successfully (status 0) the service is
deemed to be available. Only one instance of service
may be started, so
alternate providers will block and may fail.
Using provide it is possible to have multiple potential providers for the same (generic) service (e.g. sendmail and qmail both provide a mta service), where only one actually provides the service. This may be used by service startup scripts which check for configuration files.
The exit code from need is 0 if the service was successfully started, 1 if the service failed badly, and 2 if the service is unavailable (i.e. disabled in configuration files). These exit codes reflect the exit codes from the service startup scripts.
The exit code from need -r is 0 if the service was successfully stopped, 1 if the service could not be stopped, and 2 if the service was not available to start with. The service shutdown scripts may only return 0 (for success) or 1 (for failure).
The exit code from provide is 0 if the service may be provided, 1 if it may not, and 2 if the parent process is not a child of init. It may block waiting for another provider which is initialising the service.
initctl(8) uses
SIGUSR1
, SIGUSR2
and SIGPOLL
for communication with simpleinit(8). Don't send
these signals to it.
/dev/initctl
This is the control FIFO, created by simpleinit(8), which initctl(8) writes commands to.
simpleinit(8), init(8)
A more complete discussion of the new boot script system, based on need(8), is available from: http://www.atnf.csiro.au/~rgooch/linux/boot-scripts/
The initctl command is part of the util-linux-ng package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
Copyright (C) 2000-2001 Richard Gooch This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Richard Gooch may be reached by email at rgoochatnf.csiro.au The postal address is: Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. initctl.8 Richard Gooch 21-FEB-2001 |