Process Management


graphics/crontab_icon.gif

Process Management is broken down into two areas that allow you to control and schedule processes. Process Control allows you to control an individual process by performing such tasks as viewing it, changing its nice priority, killing it, stopping it, or continuing it. You can also view and schedule cron jobs under Scheduled Cron Jobs . Figure 10-38 shows the menu hierarchy of Process Management :

Figure 10-38. Process Management Menu Structure

graphics/10fig38.gif

Process Control

graphics/psa_icon.gif

When you pick Process Control, SAM lists the processes on your system and allows you to perform various actions. Using Process Control is a much easier way of controlling the processes on your system than is executing commands such as ps, nice , etc. Figure 10-39 shows a partial listing of processes:

Figure 10-39. Partial Process Control Listing.

graphics/10fig39.gif

There are the four columns of information listed for.

  • User - The name of the user who owns the process.

  • Priority - The priority of the process determines its scheduling by the CPU. The lower the number, the higher the priority. Unless you have modified these priorities, they will be default priorities. Changing the priority is done with the nice command.

  • Nice Priority - If you have a process that you wish to run at a lower or higher priority, you could change this value. The lower the value, the higher the CPU scheduling priority.

  • Command - Lists the names of all the commands currently being run or executed on the system.

In addition to these four columns, there are several others you can specify to be included in the list by selecting Columns from the View menu. You can include such information as the Process ID, Parent Process ID, Processor Utilization, Core Image Size , and so on. Adding Processor Utilization as a column, for instance, shows me how much of the processor all processes are consuming, including SAM.

You can now select one of the processes and an Action to perform.

When you select a process to kill and pick Safe Kill from the Actions menu, you will see a message that indicates the process number killed and that it may take a few minutes to kill it in order to terminate cleanly. If you select a process to kill and pick Forced Kill from the Actions menu, you don't get any feedback; SAM just kills the process and you move on.

Chapter 11 covered the kill command. To save you the trouble of flipping ahead, I have included some of the information related to kill here. The kill command can be either /usr/bin/kill or kill , which is part of the POSIX shell. The POSIX shell is the default shell for HP-UX 11i. The other shells provide their own kill commands as well. We use the phrase "kill a process" in the UNIX world all the time, I think, because it has a powerful connotation associated with it. What we are really saying is that we want to terminate a process. This termination is done with a signal. The most common signal to send is "SIGKILL," which terminates the process. There are other signals you can send to the process, but SIGKILL is the most common. As an alternative to sending the signal, you could send the corresponding signal number. A list of signal numbers and corresponding signals is shown as follows :

Signal Number

Signal

SIGNULL

1

SIGHUP

2

SIGINT

3

SIGQUIT

9

SIGKILL

15

SIGTERM

24

SIGSTOP

25

SIGTSTP

26

SIGCONT

I obtained this list of processes from the kill manual page.

To kill a process with a process ID of 234 , you would issue the following command:

  $ kill -9 234  > process id (PID)        > signal number     > kill command to terminate the process 

The final selection from the Actions menu is to Modify Nice Priority of the process you have selected. If you were to read the manual page on nice, you would be very happy to see that you can modify this with SAM. Modifying the nice value in SAM simply requires you to select a process and specify its new nice value within the acceptable range.

Scheduling Cron Jobs

The Scheduled Cron Jobs menu selection lists all the cron jobs you have scheduled and allows you to Add, Zoom, Remove , and Modify cron jobs through the Actions menu. cron was described earlier in this chapter in the section "Backup and Recovery." I have included some of the cron background covered earlier to save you the trouble of flipping back.

graphics/crontab_icon.gif

The crontab file is used to schedule jobs that are automatically executed by cron. crontab files are in the /var/spool/cron/crontabs directory. cron is a program that runs other programs at the specified time. cron reads files that specify the operation to be performed and the date and time it is to be performed.

The format of entries in the crontab file is as follows:


minute      hourmonth      day      month      weekday      user  name    command

        minute  -  the  minute  of  the   hour ,  from  0-59
        hour  -  the  hour  of  the  day,  from  0-23
        monthday  -  the  day  of  the  month,  from  1-31
        month  -  the  month  of  the  year,  from  1-12
        weekday  -  the  day  of  the  week,  from  0  (Sunday)  -  6  (Saturday)
        user  name  -  the  user  who  will  run  the  command  if  necessary
        command  -  specifies  the  command  line  or  script  file  to  run

You have many options in the crontab file for specifying the minute, hour, monthday, month, and weekday to perform a task. You could list one entry in a field and then a space, several entries in any field separated by a comma, two entries separated by a dash indicating a range, or an asterisk, which corresponds to all possible entries for the field.

To list the contents of a crontab file, you would issue the crontab -l command.



HP-UX 11i Systems Administration Handbook and Toolkit
HP-UX 11i Systems Administration Handbook and Toolkit (2nd Edition)
ISBN: 0131018833
EAN: 2147483647
Year: 2003
Pages: 301

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