Open System Services Management and Operations Guide (G06.29+, H06.07+)

Managing With the Shell
Open System Services Management and Operations Guide527191-005
9-9
Defragmenting Disks
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 on page 2-34.
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.
Here are some examples of using the find command to locate and delete files:
Delete all files in /var/tmp whose names begin with TMP that have not been
accessed in thirty days:
find /var/tmp -name 'TMP*' -atime -30 | xargs rm
Delete all files that are named a.out or whose names end in .o that have not
been accessed in sixty days:
find / -W NOG -W NOE \( -name a.out -o -name '*.o' \) \
-atime -60 | xargs rm
Defragmenting Disks
OSS development environments might be similar to UNIX environments in that users
can create a large number of small files. Such files fragment your disks and slow down
disk access considerably. To restore optimum disk access speed, run the Guardian
Disk Space Analysis Program/Disk Compression Program (DSAP/DCOM) utility
periodically to defragment the disks.
You can do this:
Automatically with either the OSS shell cron command or the optional Guardian
NetBatch product
While the OSS environment is running
Without stopping any filesets before you run DCOM
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.