#!/sbin/sh
#
# @(#) $Revision: 72.7 $
#
# NOTE:    This script is not configurable!  Any changes made to this
#          scipt will be overwritten when you upgrade to the next
#          release of HP-UX.
#
# WARNING: Changing this script in any way may lead to a system that
#          is unbootable.  Do not modify this script.
#

#
# Move old log files out of the way.
#

PATH=/sbin:/usr/sbin:/usr/bin
export PATH

rval=0
set_return() {
	x=$?
	if [ $x -ne 0 ]; then
		echo "ERROR CODE $x"
		rval=1
	fi
}

case $1 in
start_msg)
	echo "Clean up old log files"
	;;

'start')
	if [ -f /etc/rc.config.d/clean ] ; then
		. /etc/rc.config.d/clean
	else
		echo "ERROR: /etc/rc.config.d/clean defaults file MISSING"
	fi
	
	if [ "$CLEAN_ADM" -eq 1 ]; then
		mask=`umask`
		umask 022
		for LOG in sulog diaglog messages 
		do
			if [ -f /var/adm/$LOG ]; then
				mv /var/adm/$LOG /var/adm/OLD$LOG
				if [ $LOG != sulog ]; then
					> /var/adm/$LOG
				fi
			fi
		done
		umask $mask
	else
		rval=2
	fi
	;;


*)
	echo "usage: $0 {start}"
	;;
esac

exit $rval
