linux 批量切割web日志shell
服务器日志批量切割工具shell
#!/bin/bash############################################## at 2012-06-07#############################################logsPath=/web/logs/workPath=$1if [ -z ${workPath} ];then echo "参数异常" exitfiif [ ! -d logsPath ];then mkdir -p ${logsPath}fi# supported pathsfor appPath in ${workPath}*; do ${appPath}/bin/shutdown.sh sleep 10 cat ${appPath}/logs/catalina.out > ${appPath}/logs/catalina.out.`date +%Y%m%d` cat /dev/null > ${appPath}/logs/catalina.out echo "daily rotating for "${appPath}" successfully at "`date +%Y%m%d` >> ${logsPath}/catalina_log.txt ${appPath}/bin/startup.shdone