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寮€鏈鸿嚜鍚姩的主要内容,如果未能解决你的问题,请参考以下文章

k8s ui 鏈嶅姟鎼缓

瀛楀吀鑴氭湰鍜孧D5鐖嗙牬鑴氭湰

瀹夎apache鑴氭湰

jenkins鎵ц鑴氭湰npm: command not found瑙e喅

Oracle寤鸿〃鑴氭湰璁板綍

MYSQL 鑷姩澶囦唤鑴氭湰