#!/bin/sh

unset LANG
LOGDIR=/var/log/last_syslog
export PATH=/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin

cd /tmp
[ ! -d ${LOGDIR} ] && mkdir -p ${LOGDIR}

DATESTR="$(date +%Y%m%d-%H%M%S)"
if [ -f crit.log ] ; then
	tail -n 4096 crit.log > "${LOGDIR}/critlog-${DATESTR}"
fi
if [ -f syslog ] ; then
	tail -n 4096 syslog > "${LOGDIR}/lastlog-${DATESTR}"
fi
if [ -f kern.log ] ; then
	tail -n 4096 kern.log > "${LOGDIR}/kernlog-${DATESTR}"
fi
busybox killall -q -KILL TMPSYSLOG
