Dave Boies is right, but in case you don't have time to get the book here's a summary.
You don't need any special editor to create these scripts, but the format is important, and it helps to understand how the mechanism works. There's a script called "skel" in /etc/init.d that can be used as a sample. You're supposed to create the actual script in /etc/init.d, called, for example, "was". Then, in /etc/init.d/rc3.d, you put symbolic links pointing back up to it. (There's a separate directory for each runlevel, most systems come up in runlevel 3, or occasionally 5.) So in /etc/init.d/rc3.d, there should be S23was and K01was BOTH pointing up to ../was. When init starts after boot, it runs a chain of scripts beginning with /etc/init.d/rc. During boot, one of these scripts looks in the appropriate runlevel directory (/etc/rc.d/rc3.d, for example. The default is in /etc/inittab), and runs all "S*" scripts IN ORDER, passing "start" as a parm. During shutdown, the script runs all "K*" scripts in order, passing "stop". It's up to the script to determine the correct action. 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. 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. 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. 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. Most of the scripts also check for variables in rc.config (which is empty in SLES8), 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, and insserv is broken and often destroys the symlink dependencies so badly the systems won't boot. > -----Original Message----- > From: Linux on 390 Port [mailto:[EMAIL PROTECTED] Behalf Of > Terry Spaulding > Sent: Friday, October 17, 2003 2:11 PM > To: [EMAIL PROTECTED] > Subject: [LINUX-390] Creating new init scripts in init.d on SLES7 > ....... > > > Do you have to use some special utility to create new init > scripts on SLES7 > ? > > I have been creating them using pico. I have a @K01was and a > @S23was to > stop and start the Websphere Application Server. > > When I created the start script and saved it the K01was > script also changed > to look like the S23was script. > > Thanks............. > > Regards, > Terry L. Spaulding > IBM Global Services > [EMAIL PROTECTED] >
