Hi,
At 02:32 p.m. 29/01/2005, Ignacio Vazquez-Abrams wrote:
On Sat, 2005-01-29 at 12:59 +1300, Reuben Farrelly wrote:
> Is there a sample skeleton /etc/init.d/ script anywhere which I can regard
> as an 'authoritative' script to base work on, and fix up other non-Fedora
> initscripts from? I had a feeling there was one in
> /usr/share/doc/initscripts-*/ but seems not...
/usr/share/doc/initscripts-*/sysvinitfiles contains both a skeleton
script and documentation.
True. But it was last modified on June 26 2002 and refers to "Red Hat
Linux 7". That makes it 2 1/2 years old, and no doubt somewhat out of date
by now. I am certain there have been subtle and slight changes to the way
the initscripts work between then and now...such as the use of $RETVAL.
It seems to be after having a look through the files today that there is
only a loosely documented standard within Redhat/Fedora core for the init
files, and perhaps it would be a useful thing for someone to actually
define _precisely_ how these scripts are to be written and what format to
use. The example in the abovementioned file is very brief. For example,
do the functions live at the top, within, or at the bottom of the
script? Should a licence be listed at the top like the smartd init
script? Should the program be defined as "$PROG" at the top or just
substituted all through the script via things like 'daemon $PROG' or just
'daemon xyzd' ? How should the start and stop functions be defined?
(smartd, kudzu differ from many others a little) Should ALL scripts
display OK when done, and have a corresponding shutdown symlink?
As an exercise in tidyness and pedanticism, I have been going through the
various init.d scripts today and found a heap of scripts that do not seem
to even indicate completion or success with "[ OK ]".
Namely:
nifd
readahead
readahead_early
rhnsd
iptables (if no rules specified - this may be OK)
rpcgssd
rpcsvcgssd
netfs (no [ OK ] message for shutting down but OK for starting up).
Bugzilla reports on those to be filed as clearly some should be doing this.
Some simply silently start, others say "Starting xyz" and then omit a
<CR>,
some appear to return [ OK ] twice. All obvious if only loading up to
runlevel 3 (as my server does) and looks pretty messy. Not everyone goes
graphical ;-)
I haven't even begun to check how many startup scripts (Sxx) have matching
shutdown (Kxx) scripts...not even sure if this is mandatory or not.
A good start would be an update to the sysvinitfiles document by someone
who knows precisely the format and rules. Someone?
reuben