shell脚本启动,关闭tomcat
2016-12-01 00:00
337 查看
#/bin/bash
#tomcatname
tomcatname=tomcat6-$1
#tomcat basedir path
tomcatpath=~/$tomcatname
#tomcat catalina.out path
logsout=$tomcatpath/logs/catalina.out
#catalina.out number
outnum=200
#outnum=`echo a = ${$inmun:-300} | awk '{print $3}'`
if [ $# -gt 4 ];then
echo 'Parameters up to four'
elif [ $# -gt 0 ];then
if [ $3 -gt $outnum ];then
outnum=$3
fi
if [ -d $tomcatpath ];then
echo $outnum 'out'
pid=`ps -ef | grep $tomcatname |grep -v grep |awk '{print $2}'`
if [ $2 == 'out' ];then
tail -fn $outnum $logsout
fi
if [ -n $pid ];then
kill -9 $pid
echo 'kill $pid $tomcatname'
sh $tomcatpath/bin/startup.sh
tail -fn $outnum $logsout
fi
else
echo "error ex :sh start.sh user|goods|order|oth [out] [num]"
fi
else
echo "error ex :sh start.sh user|goods|order|oth [out] [num]"
fi
#tomcatname
tomcatname=tomcat6-$1
#tomcat basedir path
tomcatpath=~/$tomcatname
#tomcat catalina.out path
logsout=$tomcatpath/logs/catalina.out
#catalina.out number
outnum=200
#outnum=`echo a = ${$inmun:-300} | awk '{print $3}'`
if [ $# -gt 4 ];then
echo 'Parameters up to four'
elif [ $# -gt 0 ];then
if [ $3 -gt $outnum ];then
outnum=$3
fi
if [ -d $tomcatpath ];then
echo $outnum 'out'
pid=`ps -ef | grep $tomcatname |grep -v grep |awk '{print $2}'`
if [ $2 == 'out' ];then
tail -fn $outnum $logsout
fi
if [ -n $pid ];then
kill -9 $pid
echo 'kill $pid $tomcatname'
sh $tomcatpath/bin/startup.sh
tail -fn $outnum $logsout
fi
else
echo "error ex :sh start.sh user|goods|order|oth [out] [num]"
fi
else
echo "error ex :sh start.sh user|goods|order|oth [out] [num]"
fi
相关文章推荐
- 在linux中安装jdk以及tomcat并shell脚本关闭启动的进程
- shell脚本启动关闭tomcat,查看日志和备份项目
- 使用shell脚本 启动关闭tomcat服务
- 使用shell脚本 启动关闭tomcat服务
- Shell脚本控制tomcat的docker容器的创建,删除,启动,关闭
- shell 脚本解压war包+备份+tomcat自动关闭+启动
- 简易shell脚本提示Tomcat没有在正确的用户下启动。
- 用shell编写nginx脚本的启动,关闭,重加载
- 一个写得很棒的tomcat shell启动脚本
- shell脚本--部署应用到tomcat并启动tomcat
- linux使用shell脚本管理其他服务器Tomcat启动停止、自动发布
- Centos开机自动执行shell脚本启动tomcat服务器
- 设置的crontab脚本无法启动、关闭tomcat解决
- Linux封装启动和关闭tomcat进程脚本
- [shell] tomcat启动脚本评析 - 1. startup.sh
- 设置的crontab脚本无法启动、关闭tomcat解决
- shell脚本启动,tomcat意外退出的问题
- jenkins 通过shell启动tomcat会随着job完成而被自动关闭的解决方法
- Hudson 执行shell脚本(Hudson 启动Tomcat 无效问题)
- 一个nginx启动关闭重启的shell脚本