|
这篇文章主要为大家详细介绍了linux设置tomcat自启动的方法,文中示例代码和步骤介绍的非常详细,零基础也能参考此文章,感兴趣的小伙伴们可以参考一下。
一、在/etc/init.d/下新建tomcat文件vim/etc/init.d/tomcat写入如下脚本#!/bin/bash#description:startstoprestart#processname:Tomcat#chkconfig:2342080exportJAVA_HOME=/usr/local/javaCATALINA_HOME=/usr/local/tomcat-xxxxxcase$1instart)sh$CATALINA_HOME/bin/startup.sh;;stop)sh$CATALINA_HOME/bin/shutdown.sh;;restart)sh$CATALINA_HOME/bin/shutdown.shsh$CATALINA_HOME/bin/startup.sh;;*)echo'pleaseuse:tomcat{start|stop|restart}';;esacexit0二、赋予tomcat文件权限chmod+x/etc/init.d/tomcat三、配置开机启动启动:servicetomcatstart停止:servicetomcatstop重启:servicetomcatrestartchkconfig--addtomcatchkconfigtomcaton关闭tomcat服务自启动:chkconfigtomcatoff删除tomcat服务在chkconfig上的管理:chkconfig–deltomcat上文描述的就是linux设置tomcat自启动的方法,具体使用情况还需要大家自己动手实验使用过才能领会。如果想了解更多相关内容,欢迎关注Vecloud行业资讯频道! |
|