AIX 5L Basics (Unit 11) – Controlling Processes

Monitoring Processes:
ps – print information about processes
-e – display every process
-u – current user processes
-f – full listing (User Name, PPID, Start Time)
-l – long listing (User Id, PPID and priorities)

ps -ef

Controlling Processes:
1. Foreground Processes (ksh)
2. Background Processes (&)

Background Processes: (&)
1. Always redirect output of background processes.
2. Cannot require keyboard input.

Terminating Processes:
cntl-c – Interupt key, cancels a foreground process
kill pid# – kill a foreground or background process
kill -9 pid# – Send kill command directly to pid#

Note: cntl-c may not always work since it may be trapped by a script or program and ignore its meaning.

Note: Using (kill -9 pid#) is dangerous if a parent process is killed since there is no parent process for the child to return to. This leaves an orphaned or zombie process running wasting system resources.

kill -1 pid# – ctrl-d
kill -2 pid# – ctrl-c
kill -3 pid# – ctrl-\
kill -15 pid# – default

Running Long Processes:

Note: Programs run with (nohup) will continue to execute even if the user who starts the process is logged off the system. In this case, the init process will adopted any process that is started with nohup.

nohup.out – If the output of a program started with nohup is not redirected to a specified file, the output will be sent to nohop.out

Rule #1: Always redirect program output.
Rule #2: Always run in back ground mode (&).
Rule #3: Never use keyboard input.

Background Jobs:
jobs – list all background processes and stopped processes
fg %job# – Move Job# to the foreground
bg %job# – Restart Job# in background
kill %job# – Terminates Job#
ctrl-z – suspends foreground processes
suspend job#

Daemon Processes:
A daemon is a never-ending processes that controls a system resource such as the printer queue.

cron – job scheduling
qdaemon – print jobs
errdaemon – records software or hardware errors.

Leave a Reply

Your email address will not be published. Required fields are marked *