Stopping and Restarting Startup Processes

I've discussed how to set up Login Items for individual users and how to manage system-level startup processes and items. However, one thing I haven't mentioned is how to stop services and processes that are already running, or how to start services that you disabled at startup or stopped manually. These aren't things most users will need to do very often, if ever, but you'll know how to do both after reading this section.

The various startup and login services discussed throughout this chapter can be broken down into three basic categories: Mac OS X system-level services, located in /System/Library/ StartupItems and launched by SystemStarter at the end of the boot process; third-party system-level services, located in /Library/StartupItems and launched by SystemStarter immediately after the OS services; and user-level (and user-specific) login items, listed in the Login Items pane of System Preferences and launched when the user logs in.

You can view active processes, and figure out whether they are system-level or user-level, using Apple's Process Viewer application, located at /Applications/Utilities/Process Viewer. After you launch Process Viewer, selecting User Processes from the Show: pop-up menu provides you with a list of all user-level processes that were launched at or since login (Figure 3.9). Selecting Administrator Processes shows all system-level processes, most of which were launched by SystemStarter during the boot process. (To see what many of these processes do, check out http://www.westwind.com/reference/OS-X/background-processes.html.)

click to expand
Figure 3.9: Using Process iewer to view user processes

How to stop and start processes depends on whether they are user-level or system-level processes.

Note 

Process Viewer actually shows all processes and applications, not just startup processes (especially if you select "All Processes" from the Show: pop-up). However, it's the easiest way to view processes by user level.

Stopping and Restarting User-Level Processes

User level:

normal

Affects:

individual user

Terminal:

no

Most user-level login items are simply applications; they show up in the Dock and can be quit just like any other applications. Others are background applications or daemons, which means that they don't show up as regular apps; however, you can stop them by selecting them in the User Processes view of Process Viewer, then choosing Processes â Quit Process. (Reasons for quitting applications vary, of course, and the scope of why you might want to quit various applications or processes is too big for this chapter; let's just say that troubleshooting is a frequent motivation.)

Starting or restarting such applications is also fairly easy. If you know where the original application resides, you can just double-click it to launch it again. However, some of these applications are difficult to find. For example, if you use Microsoft Entourage as your e-mail/ calendar program, the reminders that pop-up for appointments, to-do items, etc., are provided by a background application called Microsoft Database Daemon, located inside the Microsoft Office folder. If you find that this application is not running and want to launch it, you have to track it down, which can be a real pain. If you find yourself in this situation, the easiest solution is simply to log out and log in again. Since these processes are all user-level and launch at login, they will all be started anew when you log in. And since you're not rebooting, it's a pretty quick fix.

Stopping and Restarting System-Level Processes

User level:

admin

Affects:

all users

Terminal:

yes

System-level processes are a bit trickier than user-level processes; luckily, most users won't need to interact with them very often. However, if you find yourself needing to stop a system-level service, or if you had previously disabled such a service (as discussed earlier in the chapter) and want to start it again without having to restart, OS X allows you to use SystemStarter to do it.

I mentioned SystemStarter when I explained the boot process; I also mentioned that SystemStarter is the utility that loads services in the two /StartupItems folders at startup. What I haven't yet mentioned is that Apple has made SystemStarter available in Terminal as a way for admin users to start, stop, and restart individual services or all startup services at once. It uses a fairly simple command format:

    sudo SystemStarter action service <RETURN> 

where action is either stop, start, or restart, and service is the path to the service you wish to act on. The sudo command will ask for your account password to authenticate you as an admin user. For example, if I wanted to stop the SSH service (described more in detail in Chapter 12), I would simply type:

    sudo SystemStarter stop /System/Library/StartupItems/ssh <RETURN> 

(Try saying that ten times fast.) If I had previously disabled SSH (for example, using Boot Config as explained earlier in the chapter), and had just re-enabled it and wanted to start it without restarting my computer, I could simply type the following into Terminal:

    sudo SystemStarter start /System/Library/StartupItems/ssh <RETURN> 

SSH would be started just as if it had been loaded at startup. You can also restart a service that is already running by using restart in place of start.

You can do a few other useful things with SystemStarter. If you don't specify a particular service, SystemStarter will perform the action on all startup items. (A word of warning: don't try this with the stop action, or you'll be forced to reboot your Mac when all of the login services are stopped.) If you specify the -x option, SystemStarter will only load Apple-provided startup services; for example:

    sudo SystemStarter -x restart <RETURN> 

will stop all currently running services and restart just those provided by Apple with Mac OS X. Third-party items will not be restarted. This can come in handy when trying to figure out if third-party services are causing problems. Finally, you can execute these commands remotely if you have Remote Login enabled in Sharing System Preferences. I'll talk more about this in Chapter 12, but the gist of it is that you can take advantage of SystemStarter to troubleshoot a problematic computer remotely.

Tip 

Apple has actually provided a few scripts that perform some of the most common System-Starter actions. Located in /System/Library/SystemConfiguration/Kicker.bundle/ Resources, these scripts can be run from Terminal, or via a Telnet/SSH session: restart-AppleTalk, restart-lookupd, restart-NetInfo, and set-hostname. If you use the -g option with SystemStarter's restart action (sudo SystemStarter -g restart), you'll actually see the boot screen appear, even though you're already logged in!




Mac OS X Power Tools
Mac OS X Power Tools
ISBN: 0782141927
EAN: 2147483647
Year: 2005
Pages: 152
Authors: Dan Frakes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net