--- /dev/null
+#!/bin/sh
+
+# rotate the messages file if >= 4M
+
+if [ -f /var/log/messages ] ; then
+mess_size=`du -h /var/log/messages | sed 's/\/var\/log\/messages//' | sed 's/.*k/0/' | awk -F. '{ print $1 }'`
+if [ "$mess_size" -gt "3" ] ; then
+ d_stamp=`date | awk '{ print $3 "-" $2 "-" $6 }'`
+ mv /var/log/messages /var/log/messages-${d_stamp}
+ gzip /var/log/messages-${d_stamp}
+ echo "rotated /var/log/messages file."
+fi
+fi
+
+if [ ! -f /var/log/messages ] ; then
+ touch /var/log/messages
+ echo "touched new /var/log/messages file."
+ /etc/init.d/syslogd restart
+fi
+