CentOS7涓嬪埄鐢╥nit.d鍚姩鑴氭湰瀹炵幇tomcat寮€鏈鸿嚜鍚姩
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7涓嬪埄鐢╥nit.d鍚姩鑴氭湰瀹炵幇tomcat寮€鏈鸿嚜鍚姩相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e9%9c%80%e8%a6%81' title='闇€瑕?>闇€瑕?/a> 鑷惎 java_home catalina desc style ice mon 鍚姩
1.鍦?etc/init.d/鐩綍涓嬪垱寤簍omcat鏈嶅姟鑴氭湰鏂囦欢 鍐呭濡備笅
#!/bin/bash # # tomcat startup script for the Tomcat server # # # chkconfig: 345 80 20 # description: start the tomcat deamon # # Source function library . /etc/rc.d/init.d/functions prog=tomcat JAVA_HOME=/usr/java/jdk1.8.0_91/ # 鏍规嵁鑷繁鐨勮矾寰勬敼鍐橨AVA_HOME export JAVA_HOME CATALANA_HOME=/home/work/tomcat/ # 鏍规嵁鑷繁鐨勮矾寰勬敼鍐機ATALANA_HOME export CATALINA_HOME case "$1" in start) echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; stop) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh ;; restart) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh sleep 2 echo echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; *) echo "Usage: $prog start|stop|restart" ;; esac exit 0
2.璧嬫潈
[root@localhost /]# cd /etc/init.d/ [root@localhost init.d]# chmod 755 tomcat #璧嬩簣鏉冮檺 [root@localhost init.d]# service tomcat start #鍚姩鏈嶅姟 Starting tomcat (via systemctl): [ 纭畾 ] [root@localhost init.d]# service tomcat stop #鍋滄鏈嶅姟 Stopping tomcat (via systemctl): [ 纭畾 ] [root@localhost init.d]# service tomcat restart #閲嶅惎鏈嶅姟 Restarting tomcat (via systemctl): [ 纭畾 ]
3.鍔犲叆绯荤粺鑷惎
[root@localhost zm]# chkconfig tomcat on #鏈嶅姟鑴氭湰鍔犲叆鍒扮郴缁熷惎鍔ㄩ槦鍒?
[root@localhost zm]# chkconfig --list tomcat #妫€鏌omcat鏈嶅姟鏄惁宸茬粡鐢熸晥
娉ㄦ剰锛氳杈撳嚭缁撴灉鍙樉绀?SysV 鏈嶅姟锛屽苟涓嶅寘鍚師鐢?systemd 鏈嶅姟銆係ysV 閰嶇疆鏁版嵁鍙兘琚師鐢?systemd 閰嶇疆瑕嗙洊銆? 濡傛灉鎮ㄦ兂鍒楀嚭 systemd 鏈嶅姟,璇锋墽琛?鈥?/span>systemctl list-unit-files鈥?/span>銆? 娆叉煡鐪嬪鐗瑰畾 target 鍚敤鐨勬湇鍔¤鎵ц 鈥?/span>systemctl list-dependencies [target]鈥?/span>銆?/pre>
tomcat8 0:鍏? 1:鍏? 2:寮€ 3:寮€ 4:寮€ 5:寮€ 6:鍏?/pre>
4.reboot,楠岃瘉
涓€鑸儏鍐典笅锛屽惎鍔ㄦ槸娌℃湁闂鐨勩€?/p>
杩欓噷澶氳鐐瑰効锛屽洜涓篊entOS7鐨勮嚜鍚姩鏈嶅姟寮€濮嬬敱systemctl閫愭笎鏇夸唬浜嗘棭鏈熺増鏈腑鐨刢hkconfig鍜宻ervice褰㈠紡銆?nbsp;
杩欓噷鎴戝皾璇曚簡涓€涓嬬敤鎸囦护锛歴ystemctl start tomcat8鍚姩鏈嶅姟锛岀郴缁熸彁绀簊ystemctl daemon-reload鍛戒护鍔犺浇鏈嶅姟锛屾墽琛屽悗锛屽彂鐜板彲浠ラ€氳繃systemctl鍛戒护杩涜绠€鍗曠殑鎺у埗锛屽鏌ヨ鐘舵€侊紝鍚姩鏈嶅姟锛岀粓姝㈡湇鍔★紝閲嶅惎鏈嶅姟绛夋搷浣溿€備絾鏄叧浜庡紑鏈哄惎鍔ㄧ殑璁剧疆鏄笉鍙互鐨勶紝杩橀渶瑕侀€氳繃鑰佸懡浠hkconfig瀹炵幇銆?/p>
4.
以上是关于CentOS7涓嬪埄鐢╥nit.d鍚姩鑴氭湰瀹炵幇tomcat寮€鏈鸿嚜鍚姩的主要内容,如果未能解决你的问题,请参考以下文章