If you are investigating a system that seems hung (perhaps the public website isn’t responding and your management wants you to “do something”), the old tried-and-true method of restarting services or the entire system itself is often your last resort. Rebooting Windows always fixes problems, so you already know one method for approaching Linux issues too! In this chapter, I show you how to restart services and reboot the system.
Most commands in this report will not alter system state. However, this chapter covers commands that start, stop, and restart Linux services and the entire system. Therefore, you could possibly stop something, and because of the situation you are investigating, not be able to restart it. So be careful!
Linux services (a.k.a. daemons, which is why so many Linux services
d, such as
httpd) are similar to Windows
services. They are processes that run in the background, typically
initiated at system startup. Examples of services include web services
(Apache), database services (MySQL), and so on.
Typically, you use the
service command to start, stop, and restart
services. It requires
sudo. Figure 9-1 shows how to start the
You can see that the process ID (PID) of the service is returned by the command. You stop a service the same way, ...