Home > Articles

  • Print
  • + Share This
This chapter is from the book

Lab Exercise 3-1: Starting and Stopping a Service

In this exercise, you will start a service, and then kill it.

Complete the following steps:

  1. To start the yes service and have it output to a file in the background, type the following:

  2. yes >/dev /null &
  3. This starts the service and directs it to the file /dev/null. The "&" tells the system to put the process in the background. This also returns the PID (process ID number).

  4. To verify that the service is running, type the following:

  5. ps ax
  6. This returns a list of the services running. Near the bottom of the list, you see the PID, and under the command column, you see yes.

  7. At the prompt, type the following:

  8. kill –9 [PID #]
  9. Verify that the process has been killed by typing the following:

  10. ps ax
  11. Look for the PID in the list. If it is not there, it worked!

  • + Share This
  • 🔖 Save To Your Account