Front | Info | Lists | Newsfeeds | Study Guide | What is BSD? |
|
This is the BSDA Study Guide Book written via a wiki collaboration. This is a work in progress. You may contribute to or discuss this specific page at http://bsdwiki.reedmedia.net/wiki/Configure_a_service_to_start_at_boot_time.html. Configure a service to start at boot timeConceptRecognize that the BSD boot process does not use runlevels. Be able to configure essential services to start at boot time to minimize the impact of a system reboot. TODO: PUT THIS NEXT TO RELATED CONCEPTS IntroductionThe BSDs all run the /etc/rc system startup script. It is ran by /sbin/init (known as the "parent of all processes") before it initializes the terminals and local logins. Note that the BSDs do not have System V-style runlevels, such as found on Linux, where different startup scripts are available for networking, X11 workstation, server, etc. (On systems with multiple runlevels, these are normally done by using symlinks in the specific runlevel directories pointing to the desired startup scripts.) TODO: should this mention single-user mode here? Point to it. The /etc/rc scripts vary on each system, but all basically do the same steps:
Some other tasks that may be enabled include:
TODO: more to list On OpenBSD, the /etc/rc script is mostly self-contained, while on DragonFly, FreeBSD, and NetBSD, the /etc/rc script runs many individual startup scripts, commonly found in the /etc/rc.d/ directory. Details about about using rc.d scripts as used on NetBSD, FreeBSD and DragonFly are covered in section Use an rc(8) script to determine if a service is running and start, restart or stop it as required. The BSDs primarily use /etc/rc.conf to configure what is started up. The configurations are done by setting a shell variable so be careful to use proper Bourne shell syntax such as no spaces around equal signs and making sure quotes are ended. OpenBSD ConfigurationOn OpenBSD, /etc/rc.conf contains the system defaults. It is suggested to keep custom settings in /etc/rc.conf.local which overrides the defaults. On OpenBSD, the shell variables can be set to "NO" to disable that feature or set to the command-line arguments (flags). For example, here is an example of some enabled settings on OpenBSD:
And here are some disabled settings on OpenBSD:
Note in the above example, even though spamlogd_flags is not set to NO, it is disabled because spamd_flags=NO. And even though nfsd_flags has command-line arguments, it also disabled via nfs_server=NO. TODO: do formatting here TODO: add separate sections for other BSDs here On NetBSD, FreeBSD, and DragonFly, the rc.conf defaults are stored in the /etc/defaults/rc.conf file. The settings in /etc/rc.conf override the defaults. Do not edit the defaults so upgrades are easier. TODO: FreeBSD and DragonFly also use /etc/rc.conf.local by default but NetBSD does not. TODO: /etc/rc.conf.d/ directory is also available but don't over in this intro book? TODO: make sure this is not redundant with other sections ExamplesPractice ExercisesMore informationrc.conf(5) (or rc.conf(8) on OpenBSD), rc(8), inetd(8)
|