Adding Startup Items
To
automatically start
applications, you have two choices: start them when a user logs in,
or start them when the system boots up. On most Unix systems, startup
applications either reside in the
/etc/rc.local
script or the
/etc/init.d
directory. Under Mac OS 9, you could
add a startup item by putting its alias in
System
Folder:Startup
Items
. Mac OS X has a different approach,
described in the following sections.
Login Preferences
To start an
application each time you log in, use the Accounts panel of System
Preferences and select the Startup Items tab. This is good for user
applications, such as
Stickies or an
instant messenger program. For
system daemons, you should set up a directory in
/Library/StartupItems
, as described in the next
section.
Startup Items
If you compile and install a daemon, you’ll probably want it to start at boot time. For example, MySQL will build out of the box on Mac OS X (you can download it from http://www.mysql.com).
A startup item is controlled by three things: a folder (such as /Library/StartupItems/MyItem), a shell script with the same name as the directory (such as MyItem), and a property list named StartupParameters.plist . The shell script and the property list must appear at the top level of the startup item’s folder. You can also create a Resources directory to hold localized resources, but this is not mandatory.
To set up the MySQL startup item, create the directory /Library/StartupItems/MySQL. Then, create two files in that ...
Get Mac OS X Panther for Unix Geeks, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.