O'Reilly logo

Ten Steps to Linux Survival by James Lehmer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Step 9: Starting and Stopping

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!

Managing Services

Linux services (a.k.a. daemons, which is why so many Linux services end in d, such as sshd and 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 mysql service.

service start command
Figure 9-1. service start command

You can see that the process ID (PID) of the service is returned by the command. You stop a service the same way, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required