Startup Scripts and Startup Items
After launchd executes successfully, it runs the /etc/rc script to perform basic system initialization tasks. These initialization tasks include a file-system consistency check (fsck) and starting a process called SystemStarter, which launches the startup items.Startup items are processes that run during the last phase of the startup sequence to prepare a Mac OS X system for normal operation. Startup items consist of programs, including customizable shell scripts, which perform tasks such as starting additional system daemons.Lesson 3, "User Accounts."Many startup scripts rely on system configuration information stored in /etc/hostconfig. Some entries in hostconfig specify whether certain services should be started when the computer starts up. For example, when you turn on Personal Web Sharing, the Services pane of Sharing preferences sets an entry in hostconfig:
When the Apache startup item executes during system startup, it checks whether the WEBSERVER value is set to YES, and if so, it starts the Apache web server.A number of processes are already running by the time the user logs in to a Mac OS X system. Most of these processes are daemons or processes created by the system that run in the background. In addition to those started by launchd and startup scripts, a handful of processes are created on behalf of the user by the loginwindow process and the Window Manager daemon.
WEBSERVER=-YES-