重启tomcat? 每次都要查找进程,清空日志,杀死进程。。这些重复步骤.
不如编写个自动重启的shell脚本,避免重复工作而且不会出错哦。
#!/bin/sh
#tomcat 绝对路径
TOMCAT_PATH=/opt/va/platform
#查找进行id
pid=`ps aux | grep "$TOMCAT_PATH"| grep -v "grep" | awk '{print $2}'`
cd $TOMCAT_PATH/logs
echo "pid is $pid"
if [ $pid > 0 ]; then
echo "pid $pid is running, kill it "
rm $TOMCAT_PATH/logs/*
kill -9 "$pid"
fi
sh $TOMCAT_PATH/bin/startup.sh | cat
保存脚本后直接执行即可.