定时更新服务器日志脚本(原创)

DATE=`date +%Y-%m-%d_%Hh%Mm`
DATEACCESS=$DATE'_access.log'
DATEERROR=$DATE'_error.log'
echo stoping lighttpd...
echo mv lighttpd access error ... to ... [$DATEACCESS] [$DATEERROR]
mv /others/lighthttpd/logs/access.log /others/lighthttpd/logs/$DATEACCESS
mv /others/lighthttpd/logs/error.log /others/lighthttpd/logs/$DATEERROR
killall lighttpd
echo starting lighttpd...
/others/lighthttpd/sbin/lighttpd -f /others/lighthttpd/conf/lighttpd.conf

再修改crontab文件

Tags:

About the Author