#!/bin/sh # chkconfig: 345 99 10 # description: Auto-starts tomcat # /etc/init.d/tomcatd # Tomcat auto-start # Source function library. . /etc/init.d/functions # source networking configuration. . /etc/sysconfig/network RETVAL=0 # CATALINA_HOME="/usr/local/tomcat" export JAVA_HOME=/usr/local/java/jdk1.7.0_40 export CATALINA_HOME=/usr/local/tomcat export CATALINA_BASE=/usr/local/tomcat TOMCATUSER=root start() { if [ -f $CATALINA_HOME/bin/startup.sh ]; then echo $"Starting Tomcat" /bin/su $TOMCATUSER -c $CATALINA_HOME/bin/startup.sh RETVAL=$? echo " OK" return $RETVAL fi } stop() { if [ -f $CATALINA_HOME/bin/shutdown.sh ]; then echo $"Stopping Tomcat" /bin/su $TOMCATUSER -c $CATALINA_HOME/bin/shutdown.sh RETVAL=$? sleep 1 ps -fwwu tomcat | grep apache-tomcat|grep -v grep | grep -v PID | awk '{print $2}'|xargs kill -9 echo " OK" # [ $RETVAL -eq 0 ] && rm -f /var/lock/... return $RETVAL fi } case "$1" in start) start ;; stop) stop ;; restart) echo $"Restaring Tomcat" $0 stop sleep 1 $0 start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 ;; esac exit $RETVAL ~ ~
tomcat自启动脚本
原创JamesLee86 博主文章分类:linux服务器管理 ©著作权
©著作权归作者所有:来自51CTO博客作者JamesLee86的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
centos下nginx,tomcat开机自启动脚本
01 #!/bin/bash 02 # 03 # ng
tomcat nginx 开机启动 -
开机自启动脚本
开机自启动脚本
开机 自启 动脚本