The difference between the Slackware startup script and the System V startup script

Source: Internet
Author: User
Tags bind advantage

Slackware version: Slackware 7.0 and above

Slackware uses BSD-style init scripts, while many other distributions use System V-style init scripts. SysV and BSD scripts are all readable, that is, they are shell scripts, not compiled programs. The main difference is how the script is designed.

SysV scripts tend to accept parameters such as Start, stop, and restart, depending on the program it starts. So you can start bind with a command like/etc/init.d/bind start and use/etc/init.d/bind stop to stop bind.

SysV startup also tends to use symbolic links to organize startup processes, such as in/etc/rc.d/rc.4/, which may have various symbolic links to real scripts in other directories. These linked commands will look like S10network, S25xdm, where S is the start (start) service (if it is k, kill), and the number specifies the order in which the script executes.

The main advantage of the SYSV-style startup script is that it can be set up to configure many things automatically. For example, if you enter RunLevel 6, you can create a link called K75bind to terminate bind, provided the link points to a file that has been set up to do so.

The main disadvantage of the SysV style script is that it is too curved. If I wanted to add a service, I'd write a sysv-style script (not easy), and it would at least handle "start" (and possibly "stop"). Then, I have to make sure that the symbolic links are correctly set in each runlevel that will run the service. If this service needs to run between two consecutive scripts that are numbered consecutively, I need to do some renumbering of symbolic links (for example, s10xxx and s11yyy already exist, and I want zzzz to run between them, I would need to re-establish the symbolic links to one of the first two to squeeze the zzzz in.

It is also very painful to change the SYSV start process for the time being. If I do not want to run the XXX service at the next startup, the easiest way is to delete the s10xxx link, is it not difficult? But if I want to get rid of it in every runlevel, I need to remove the s10xxx link from each of the relevant directories. Then, if I change my mind and want to rerun XXX, I need to manually re-establish all the symbolic links.

This is certainly duplication on the already complex start-up process, and Slackware does not: It uses BSD-style startup scripts.

BSD-style scripts are straightforward shell scripts that tend to run sequentially without the need for parameters such as start or stop. As long as the system goes into their runlevel, it's as simple as that.

The main disadvantage of BSD style is that you need some other way to control the backend service. For example, if I want to stop bind, I will first use the command PS Ax|grep named to find the named PID, and then kill the PID (or use the PID filename). But I can't simply/etc/init.d/bind stop the next command (unless I've already written a sysv script like this).

The main advantage of BSD style scripts is that they are easy to read and edit. For example, if I want to add a service zzzz, I can add a row of/usr/local/bin/zzzz to the/etc/rd.d/rc.local, so that the runlevel,zzzz that executes rc.local will run with it. If I only wanted to execute zzzz at RunLevel 4, I could put it in/etc/rc.d/rc.4 (not a directory, but a script). If I want to change the order of execution, I just put zzzz between the right services, and most editors support inserting text in the middle of the file (even Ed supports it). Also, you can use annotations to stop a service and then remove the annotation to let it run again.

Therefore, when most distributions adopt SYSV style, the Slackware is in BSD style. For many Slackware users, the BSD-style ease of use trumps the powerful features of the SYSV style. Of course, you can have your own opinion.

Contrary to popular belief, it is not so difficult to move from one style to another, as long as you copy Inittab and RC files from one system to another. The INIT program itself has not changed, and the so-called "style" is set in Inittab and in the script it invokes.

Now Slackware in order to improve compatibility,/etc/rc.d/provides rc.sysvinit scripts to accommodate the needs of some business processes based on the SYSV startup process. In addition, in many of the scripts that set up services, you also accept parameters such as Start, stop, and restart, such as Rc.sendmail, rc.sshd, and so on.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.