一、在/etc/init.d/下新建tomcat文件 vim /etc/init.d/tomcat 写入如下脚本 #!/bin/bash #description:  start stop restart #processname: Tomcat #chkconfig: 234 20 80 export JAVA_HOME=/usr/local/java CATALINA_HOME=/usr/local/tomcat-xxxxx case  $1 in                start)                      sh $CATALINA_HOME/bin/startup.sh                      ;;               stop)                      sh $CATALINA_HOME/bin/shutdown.sh                      ;;             restart)                      sh $CATALINA_HOME/bin/shutdown.sh                      sh $CATALINA_HOME/bin/startup.sh                      ;;                   *)                                    echo 'please use: tomcat {start | stop | restart}'                      ;;                   esac exit 0 二、赋予tomcat文件权限 chmod +x /etc/init.d/tomcat 三、配置开机启动 启动:service tomcat start 停止:service tomcat stop 重启:service tomcat restart chkconfig --add tomcat chkconfig tomcat on 关闭tomcat服务自启动:chkconfig tomcat off 删除tomcat服务在chkconfig上的管理:chkconfig –del tomcat

一、在/etc/init.d/下新建tomcat文件 vim /etc/init.d/tomcat 写入如下脚本 #!/bin/bash #description:  start stop restart #processname: Tomcat #chkconfig: 234 20 80 export JAVA_HOME=/usr/local/java CATALINA_HOME=/usr/local/tomcat-xxxxx case  $1 in                start)                      sh $CATALINA_HOME/bin/startup.sh                      ;;               stop)                      sh $CATALINA_HOME/bin/shutdown.sh                      ;;             restart)                      sh $CATALINA_HOME/bin/shutdown.sh                      sh $CATALINA_HOME/bin/startup.sh                      ;;                   *)                                    echo 'please use: tomcat {start | stop | restart}'                      ;;                   esac exit 0 二、赋予tomcat文件权限 chmod +x /etc/init.d/tomcat 三、配置开机启动 启动:service tomcat start 停止:service tomcat stop 重启:service tomcat restart chkconfig --add tomcat chkconfig tomcat on 关闭tomcat服务自启动:chkconfig tomcat off 删除tomcat服务在chkconfig上的管理:chkconfig –del tomcat

  • 版权声明:文章来源于网络采集,版权归原创者所有,均已注明来源,如未注明可能来源未知,如有侵权请联系管理员删除。

发表回复

后才能评论