One comment

On Fri, Oct 17, 2003 at 03:10:24PM -0400, Hall, Ken (IDS ECCS) wrote:
> In SLES7, there should be symlinks for every daemon, so they all get
> run. Each script calls /etc/rc.config, which contains environment
> variables set by YAST to control which daemons actually start.

Actually, SLES7 has insserv. If you want to create a new service with
just insserv lines? fine. YaST does not have to be insvolved. Just use
insserv to add and 'insserv -r' to remove. YaST is just a wrapper here.

>
> In SLES8, though, the mechanism is different, and more like the
> original SYSVINIT mechanism also used by Red Hat.  Only "active"
> daemons have symlinks, and a "runlevel editor" in YaST controls how
> they get set. This mechanism can cause problems if you're porting
> scripts over from SLES7 and not familiar with what's going on.
>
> SLES8 adds the "chkconfig" and "insserv" programs to manage the
> runlevel symlinks.  These programs use a comment block at the
> beginning of the script to determine dependencies, and create and
> maintain the symlinks dynamically.  It's not a good idea in SLES8 to
> try to manage the symlink names manually, since RPM installs often
> run "insserv", which triggers automatic resequencing of the symlinks.

Actually, SLES7 has insserv. And sles7 rpm packages use it to install.
It doesn't have chkconfig and /etc/sysconfig .

> Scripts without a valid comment block at the beginning are usually set
> to "S01", so they start before everything else.  This can be a bad
> thing if the daemon needs network services.

Are you sure? Aren't such scripts simply ignored?

>
> If you're doing a script for distribution, it's a good idea to include
> the SLES8/United Linux style comment block at the beginning.  This way
> the script will work on either OS.

Yes, but: you should have an idea of exactly what your script requires?

* does it need /usr to be mounted?
* does it need networking started?
* does it need syslog running?
* does it need NFS?
* does it need LDAP?
* does it Samba?

Something more interesting:

* Do you actually have two services and one of them requires the other?

Recall that insserv will fail to install your script if the installed
system won't provide such a capability. Also recall that your technical
support folks will rather have a system that is a bit diffiuclt to
install than a system that is easy to install but won't start.

And a similar note: note that RedHat's standard chkconfig init.d scripts
comments are different, and thus compatible and can reside on the same
script.

> Most of the scripts
> also check for variables in rc.config (which is empty in SLES8),

This is incompatible with other distros, though.

# in case we run on SuSE SLES7 (or SuSE < 8.0?) get config from
# /etc/rc.config:
if [ -r /etc/rc.config ] # -r? -x?
  . /etc/rc.config
fi

Should work on most such cases.

> but I gave up on trying to support both levels in a single script,
> and just build different packages for 7 and 8.
>
> This is all explained in a lot more detail in the man page for
> "chkconfig" on SLES8.  SLES7 has a partial implementation of this
> mechanism, but it doesn't quite work, so you have to maintain the
> symlinks manually.  /sbin/chkconfig is a do-nothing shell script,

Arrrr!

I hate this habit of SuSE:

if chkconfig --add myservice; then
  echo "chkconfig returned success, so installation worked"
else
  echo "Huston, we have a problem"
fi

Such a scriptlet "won't run into a problem" in SLES7.

> and
> insserv is broken and often destroys the symlink dependencies so badly
> the systems won't boot.

Maybe broken, but in practice it is used. Check the (overly complicated)
installation script of every rpm package. Try installing a suse package
on your system.

--
Tzafrir Cohen                       +---------------------------+
http://www.technion.ac.il/~tzafrir/ |vim is a mutt's best friend|
mailto:[EMAIL PROTECTED]       +---------------------------+

Reply via email to