Unix - Services & Health
TechNotes      |     Unix Home

 

    There are various ways to check the health and services on a box. From space issues, to resolving process problems, or even just performing analysis, the following commands can be used by themselves or even in combination.
To check process status
 
ps
To check processes for a specific application
In this example, we're looking for any process that has 'https' in it's name or directory string.
  1. > ps -ef | grep https
 
In this example, we're looking for any process that might be running as a specific user id. (abcuser)
  1. > ps -ef | grep abcuser
To kill a process
 
kill
Occassionally a process will need to be terminated. The kill command is used to do this. List the processes currently running (use the ps command). You'll get something back that looks like this:
 
root        19976    1         0 Jun 09    ?    0:01    /www/apache/bin/httpsd.prefork -d /www/servers/ie3 -D
nobody 20296    19976 0 Jun 09    ?    0:11    /www/apache/bin/httpsd.prefork -d /www/servers/ie3 -D
 
The process ids are the 1st 2 numbers. The first number (ie: 20296) is the number for that process listed on the same line. The second number is the parent process (ie: 19976) which spawned the process. For instance, process 1 listed above (root 19976) spawned process 2 (nobody 20296).
 
When you want to stop a process, you want to stop both the child processes and the parent. But you should stop the children first. You can do this in one continual line as:
  1. > kill -9 20296 19976
To check a service connection
 
telnet
Projects often use various servers to support their applications. Such as database, mail, logic or file transfer servers. If something happens to an application that requires checking on the connections between servers, you can use the telnet commant to verify if the other server and/or port is listening.
  1. > telnet boxname port#
(ie: telnet appbox100 5460)