系统运维批处理脚本

nginx 日志定期切割

 cp  /usr/local/nginx/logs/access.log  /usr/local/nginx/logs/access"$(date -d yesterday +%Y%m%d)".log
echo "" > /usr/local/nginx/logs/access.log

重启脚本

 

#restart.sh
#tomcat_home=/opt/apache-tomcat-6.0.32
 
ps -ef |grep tomcat  |awk {'print $2'} | sed -e "s/^/kill -9 /g" | sh -

ps -ef |grep tomcat 
source /etc/profile
echo "tomcat01"
/home/b2c/tomcat01/bin/startup.sh
echo "tomcat02"
/home/b2c/tomcat02/bin/startup.sh

 

数据库清理脚本

#tomcat_home=/opt/apache-tomcat-6.0.32 
source /etc/profile
echo "cleanyhxwtj"
java -jar /home/b2c/yhxwtj.jar

 

清理日志

echo "" > /home/b2c/tomcat01/logs/catalina.out
echo "" > /home/b2c/tomcat02/logs/catalina.out

 

你可能感兴趣的:(系统运维批处理脚本)