Adding a status action to init scripts

Posted in Uncategorized on July 24th, 2008 by Dave Walker

Surely if you have administered a Linux server, you have used the scripts in /etc/init.d/ to start, stop, and restart system services. What about the status action to determine if a given service is up and running?

The Ubuntu Server team has initiated a concentrated effort to add status actions to the most commonly used init scripts. We’re recruiting current and aspiring Ubuntu developers to help patch these init scripts. Some Unix shell programming and basic Debian packaging skills are all that is required.

Basically, you need to do:

  1. grab the source
  2. add two lines to the service’s init script
  3. add a dependency in the control file
  4. create a changelog entry
  5. post a debdiff to a Launchpad bug.

There is detailed step-by-step checklist for creating and submitting such packages on the wiki page.

The Linux Standard Base 3.1 has a specification for init scripts actions. A simple function has been added to the LSB base library /lib/lsb/init-functions. This shell function, status_of_proc(), can be used in most init scripts to report status.

The list of init scripts that need work is also maintained in the wiki page. Join us in IRC at #ubuntu-server if you are interested in helping!