> -----Original Message----- > From: Linux on 390 Port [mailto:[EMAIL PROTECTED] Behalf Of > Tzafrir Cohen > Sent: Sunday, October 19, 2003 2:41 AM > To: [EMAIL PROTECTED] > Subject: Re: [LINUX-390] Creating new init scripts in init.d on SLES7 > .... ... > > > 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.
Insserv on SLES7 seems to be broken. The couple of times it's run here, it resequenced the symlinks so the system wouldn't come up, even though the dependencies in the comment blocks were correct. After fixing the links by hand a couple of times, we disabled it. > > > > > 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 . Which is how we found out it was broken. We upgraded some packages, and suddenly the systems wouldn't boot. Checking the symlinks, several important ones were out of order. > > > 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? > No, scripts with no comment block are set to S01. We got bit by this more than once before we figured out what was going on. > > > > 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? > Absolutely right. See the chkconfig man page for an explanation of the dependency controls. > 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. > Yep, that's right, but maintaining the extra code and having the RPM script install the required lines in an unused rc.config was just a big pain. > > 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. > See above. We know it's used, that's how I found out it was broken. > -- > Tzafrir Cohen +---------------------------+ > http://www.technion.ac.il/~tzafrir/ |vim is a mutt's best friend| > mailto:[EMAIL PROTECTED] +---------------------------+ >
