[RFC] Bootscript changes

Dan Nicholson dbn.lists at gmail.com
Tue Apr 10 08:13:12 PDT 2007

I've been digging around in the bootscripts a little more lately, and
I've found some behavior that I think could be changed and I'd like
comments on. I can provide patches later, but first I thought I'd like
to hear comments.

1. Make statusproc() return unsuccessfully if the process isn't running

Right now, statusproc always returns successfully with a list of pids
for the requested process name or a message saying that it's not
running. I think it would be more helpful to have it return
unsuccessfully if there are no processes by that name running. In
order to do this right now, I need to parse the output. This is a one
line fix. Basically, I want to do something like this from a script:

if /etc/rc.d/init.d/process status >/dev/null; then
    /etc/rc.d/init.d/process restart

2. Make statusproc() use pidofproc() instead of the deprecated getpids()

statusproc is using getpids, which has been marked as deprecated in
the functions. I think all the *proc functions should be calling
pidofproc for consistency.

3. Allow the -p pidfile argument to all *proc() functions

statusproc does not allow the pidfile argument to be passed in. This
goes along with 2. getpids will respect the variable PIDFILE, but it
should also allow the -p argument like loadproc and killproc and pass
it on to pidofproc.

4. Add the /sbin/service script to allow an agnostic way to query the

This one might be more controversial. To run the bootscripts, you need
to know the implementation detail about where they are, particularly
the info in /etc/sysconfig/rc. Ideally, there should be an agnostic
way to run these bootscripts without any prior knowledge of how LFS
has set them up.

This is not an original idea. I think all the major distros do this
(Fedora and SuSE for sure), although it's not an LSB requirement.
Where I got the idea is from the pm-utils project. This project is a
dependency of newer HAL releases which tries to provide a
distro-neutral way to run power management functions for

Part of these processes is stopping/starting system services like
ntpd. In order to do this with any sanity across multiple distros,
there has to be an agnostic way to run services. Here is a mailing
list thread discussing the /sbin/service approach, the pm-utils
functions where service or its fallback are defined (search for
service), and an example usage of service in pm-utils:


While this is only one specific case where a service wrapper could be
used, it seems like a smart idea in my opinion to hide distro-specific
implementation details where possible. I've attached the very simple
version that I came up with and has been working for me. Basically, it
just sources /etc/sysconfig/rc and then wraps the call to the
bootscript. The result can be something like this:

/sbin/service clock start

Let me know what you guys think.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: service.sh
Type: application/x-sh
Size: 580 bytes
Desc: not available
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20070410/1e17c902/attachment.sh>

More information about the lfs-dev mailing list