install_initd in RHAS 4 does not honor dependency information

Stuart Sears stuart at sjsears.com
Sat Apr 29 17:25:03 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Siddegowda, Kishore (STSD) wrote:
> Hi All,
> 
> I am having trouble getting the correct order enforced on two init.d
> scripts that i want to run during start up. I run 'install_initd' on
> these scripts to generate the rc links in the repsective runlevel
> directories.
> 
> To give an example, consider the two scripts (test1 and 'atest2') below
> - 
> 
> -------------------------------------------------------
> $ cat /etc/init.d/test1
> #! /bin/sh
> 
> ### BEGIN INIT INFO
> # Provides: test1
> # Required-Start: $network $syslog $remote_fs
> # Required-Stop: $network
> # Default-Start: 2 3 5
> # Default-Stop: 0 1 6
> # Description: Test Service 1
> ### END INIT INFO
> -------------------------------------------------------
> $ cat /etc/init.d/atest2
> #!/bin/sh
> 
> ### BEGIN INIT INFO
> # Provides: atest2
> # Required-Start: test1 $network
> # Required-Stop:
> # Default-Start: 2 3 5
> # Default-Stop: 0 1 6
> # Description: Test Service 2
> ### END INIT INFO
> 
> I have intentionally named the second file 'atest2' so that it is
> lexicographically lesser than 'test1'. Note that 'atest2' specifies
> 'test1' as a dependent service in 'Required-Start'. Even then , the rc
> links created are as follows - 
> 
> S99atest2
> S99test1
> 
> It should have actually been - 
> 
> S99test1
> S99atest2
> 
> Is redhat taking ascii ordering into consideration while creating the rc
> links ?? .. I've verified that the same wrong order (atest2 , then
> atest1) is used while booting (by checking boot.log) It should have been
> (test1, atest2) according to the LSB specification.
> 
> Any ideas if this is a bug in RHAS ?

not as far as I know.
Have you considered doing things the Red Hat Way (tm)?
RHEL (and many iterations of Red Hat before it) use chkconfig to manage
symbolic links to init scripts.
put a series of commented lines at the top of your init script as follows:

#!/bin/sh
#
# chkconfig: <default_on> <start_number> <stop_number>
# description: what your script actually does
#
# further comments of your choice

e.g. (taken from /etc/init.d/sshd (technically /etc/rc.d/init.d/sshd)
#!/bin/bash
#
# Init file for OpenSSH server daemon
#
# chkconfig: 2345 55 25
# description: OpenSSH server daemon
#
i.e sshd is *on* in runlevels 2345 by default
and its symlinks will be S55sshd and K25sshd where required.

then use chkconfig --add your_script_name
which will create all the necessary symbolic links.

Regards

Stuart

ps - just for information (on a RHEL4ES box):
[root at hostname ~]# file /usr/lib/lsb/install_initd
/usr/lib/lsb/install_initd: symbolic link to `../../../sbin/chkconfig'

so it expects the information given above

- --
Stuart Sears RHCA RHCX
To err is human, to forgive is Not Company Policy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFEU6FvamPtx1brPQ4RAh0kAJoC9mv88LdVyHp96C/QDGfUtdS90wCePlwD
XAusRIErjtEm7OIIS9/cPRo=
=QhJk
-----END PGP SIGNATURE-----




More information about the redhat-list mailing list