#!/bin/sh
#****************************************************************#
# ScriptName: clean.sh
# Author: xhy
# Create Date: 2018-09-13 02:54
# Modify Author: xhy
# Modify Date: 2019-12-13 18:36
# Version: 
#***************************************************************#
cat /dev/null > /var/log/syslog
cat /dev/null > /var/adm/sylog
cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/btmp
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/messages
cat /dev/null > /var/log/openwebmail.log
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/secure
echo "" > $HOME/.bash_history

newkernel=`cat /proc/version | awk '{print $3}'`
oldkernel=`rpm -qa | grep kernel | grep -v "kernel-$newkernel"`
yum -y remove $oldkernel
yum clean all 
yum makecache                                                                                                                                                                                                                            

history -c

rm -rf /var/spool/mail/root
rm -rf /tmp/*

history -c
