定时清除 /var/log/massage 下的信息脚本
#!/bin/sh #Date: 0:07 #Author: Xiaodong #Mail: 990974238@qq.com #Punction:This scripts function is clean log massage LOG_DIR=/var/log ROOT_UID=0 if [ "$UID" -ne "$ROOT_UID" ] then echo "Must be root to run this script ." exit 1 fi cd $LOG_DIR ||{ echo "Cannot change to necessary directory." exit 1 } cat /dev/null>messages && { echo "Logs cleaned up." exit 0 } echo "Logs cleaned up fail." exit 1