Performing basic system monitoring and tuning

Clearing log files automatically

You can clear log files automatically using crontab(C) and cron(ADM). By adding a line to root's crontab file (/usr/spool/cron/crontabs/root), you can make your own file maintenance scripts execute daily, weekly, or monthly.

The following is an entry that can be added to the root crontab file to run /etc/cleanup each Sunday morning at 5:17:

   17 5 * * 0 /etc/cleanup > /dev/null
See crontab(C) for information about the format of the crontab file.


NOTE: If multiple machines mount the same NFS filesystems, all machines will run the find at the same time, searching all the NFS-mounted filesystems as well as the local filesystems. Therefore, running this script without some modifications could impose a heavy network load. Adding the -mount or -local options to the find(C) command restricts the search to the root filesystem, or local filesystems, respectively.

Although the /etc/cleanup file does not exist by default, you can create one like the one shown in ``Sample cleanup script''

:
#
# clean up super-user log
cp /var/adm/sulog /var/adm/Osulog
> /var/adm/sulog
#
# clean up volcopy log
[ -f /var/adm/log/filesave.log ] && mv /var/adm/log/filesave.log \
	/var/adm/log/Ofilesave.log
> /var/adm/log/filesave.log
chown root /var/adm/log/filesave.log
chgrp sys /var/adm/log/filesave.log
chmod 666 /var/adm/log/filesave.log
#
# clean up wtmp
> /var/adm/wtmp
#
# clean up miscellaneous files
find / -name core -atime +7 -exec rm -f {} \;

Sample cleanup script


The /etc/cleanup script:

You can specify different files to clear and when to clear them by modifying /etc/cleanup and the /usr/spool/cron/crontabs/root file.


Next topic: Using the Reports Manager
Previous topic: Clearing system log files from the command line

© 2007 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 05 June 2007