Open System Services Management and Operations Guide (G06.30+, H06.08+, J06.03+)

Monitoring the OSS Environment With the Shell
Potential problems that you might want to monitor using the shell include:
Slow performance
Overuse of resources
The examples given in this subsection are not exhaustive. You might also want to remove files from
directories that expand automatically, as discussed in “Controlling the Growth of Directories
(page 241).
Slow Performance
Slow performance might be the result of many processes left running that are no longer being used.
One way to check is to enter an OSS command such as:
ps | sort -nr +2
This command lists the output of the ps command in reverse order by the TIME field. The processes
that have run for the longest time are at the top of the list. You can then decide whether to remind
the users to stop their processes, let things be, or terminate the offending processes with the OSS
shell kill command.
Overuse of Resources
Large files that haven’t been accessed in a long time might waste resources and prevent users from
being able to create files. You might want to find users who have such files in their directories and
discuss the situation with them.
You can list the owners of large files using an OSS shell command such as the following, which
lists detailed information (including the owners) about files in /usr that are larger than 1000
kilobytes:
find /usr -size +1000K | xargs ls -l
Open System Services also provides the disk usage utilities du and df.
Controlling the Growth of Directories
The vi text editor and other programs produce temporary files that you might later want to remove.
You might also want to remove large files that have not been accessed in a long time. This subsection
describes how to remove such files.
The find command searches for files that match criteria you set; for example, it can find all the
files in a directory that have not been accessed in a specified number of days. It can then perform
an action you specify, such as deleting the files it finds. For detailed information about the find
command, see the find(1) reference page either online or in the Open System Services Shell
and Utilities Reference Manual.
You can create shell scripts that use the find command to delete files and then invoke the scripts
periodically with either the OSS shell cron command or the optional Guardian NetBatch product,
as described in “Scheduling Periodic Tasks” (page 73).
NOTE: OSS file opens do not work on Guardian processes such as the NetBatch process $ZBAT
. To work around this, redirect stdin, stdout, and stderr to files that can be opened by the
OSS environment, or close these files if they are not being used.
You would invoke the OSS environment with the TACL OSH command. You can run a single OSS
shell command such as find from within a NetBatch job by using a job file that contains the
following OSH command line:
OSH <- >outlog 2>errlog -c "command"
This command closes stdin, directs stdout to the file specified as errlog, directs stderr to
the file specified as outlog, then runs the specified command.
Monitoring the OSS Environment With the Shell 241