FreeBSD system startup script

Source: Internet
Author: User
Tags log

After the kernel has probed the system hardware, it starts process 0 and process 1, process 0 is used to clear the memory, all the memory cells are zero, process 1 is the INIT process, and will be responsible for booting the system and various daemons. Init brings the system into multiuser state and starts the service program according to the/ETC/RC startup script.

The/ETC/RC startup script will do a lot of important work, including setting up disk swapping, checking disk errors, setting up a network interface, and starting a network service program. The/ETC/RC file will also execute additional RC files, such as execution rc.conf for most system parameters, Rc.network for network settings, Rc.firewall for setting up firewalls, and rc.local for administrator specific startup settings on the machine. The rc.conf file contains many settings parameters that users can change, which are used in other RC files to configure system parameters, and are therefore most important for system management.

Because most server programs are network programs, these services will not perform properly (for example, SendMail) If your system's network settings are incorrect. And some programs have a long timeout setting, so when an error occurs, the system stops on a program and does not continue. You can usually ignore it, wait for the program to timeout, or try to interrupt the program with CTRL-C. If the startup script really appears to be an error that cannot be performed, if you can log on through the network, you may log in to the system and then change the startup script, and most of the startup scripts are in the case, the Network service does not start, then you must restart the system into Single-user state, and then modify the startup foot to correct the error.

#! /bin/sh

Swapfile= "NO" # Set to name of Swapfile if aux swapfile desired.

Apm_enable= "NO" # Set to YES if you want apmenabled.

Pccard_enable= "NO" # Set to YES if you want to configure PCCard devices.

Pccard_mem= "DEFAULT" # If Pccard_enable=yes, this is the card memory address.

Pccard_ifconfig= "NO" # Specialized PCCard Ethernet configuration (or no).

Local_startup= "/USR/LOCAL/ETC/RC.D/USR/X11R6/ETC/RC.D" # startup script dirs.

The above is part of the/etc/rc.conf, you can see the form of parameters, the corresponding setting values are prompted, making it easy to change these parameter settings. Most of the settings in rc.onf can be set by/stand/sysinstall system Setup, but some of the parameters cannot be set by Sysinstall and must be done by manually modifying the file. According to FreeBSD's custom, these RC files, rc.conf for parameter configuration, can be changed by Sysinstall Installer and administrator, rc.local define this computer-specific startup command, can be reset by the administrator, and other RC files should remain unchanged. This is just a custom, not a hard rule, but the benefit of compliance is that the system is set up to be clear, easy to maintain and manage, and that when an administrator enters a new system, it can immediately find the required configuration file.

Before version 3.1-release,/etc/rc.conf includes all parameter settings so that after the system runs for a long time, it is impossible to tell which parameter is the default and which is the value that the administrator has changed. In 3.1-release, the rc.conf is divided into two files,/etc/default/rc.conf and/etc/rc.conf, which/ETC/DEFAULT/RC. conf sets the system defaults for each parameter, and/etc/rc.conf only sets the parameters that the local system changes during installation and operation, such as hostname, so there is less content in/etc/rc.conf files after 3.1-release. In fact,/etc/default/rc.conf not only sets settings in the Read/etc/rc.conf file, but also reads the settings for the/etc/rc.conf.local file to accommodate more complex computer settings. For general situations, with less complex setup files, just notice that the settings in the/etc/rc.conf meet the setup requirements.

BSD Unix traditionally uses only rc.local to maintain native-specific startup commands, so that if the system needs to configure too much at startup, the file becomes quite large and is not conducive to system maintenance. Unix System V-style systems maintain startup commands using a startup directory instead of a file, each setting that initiates a specific feature is placed in a separate script, and all scripts are placed in the startup directory, which is checked for execution scripts in the directory at startup and automatically executes these commands.

System V and BSD boot management are very different, System V introduces the concept of startup level, there can be 6 different boot levels, and BSD is simply divided into multi-user state, Single-user state and 3 kinds of outage state. System V is more friendly than BSD in terms of boot management.

So FreeBSD absorbs the idea of the startup directory in System V, and in rc.conf defines the directory Local_startup parameters that are stored on the computer's boot files, using the default/usr/local/etc/ The RC.D directory holds the server program's startup script and uses the/USR/X11R6/ETC/RC.D directory to store the local X Window-related program startup scripts. The shell script program in these directories that ends with SH and has execution properties will be executed automatically at startup. The scripts in both directories are set up and modified by the system administrator and must end with ". Sh", and the files for the other suffixes will be ignored. It is customary that the scripts in both directories are responsible for starting the server program, while the rc.local is primarily used to adjust some of the system's non-standard parameter settings (not covered in rc.conf).

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.