Linux中的系统服务_02

      Linux中的系统服务_02      

 

     1. 在linux增加服务后,如果要实现随着操作系统的启动而启动,需要是用chkconfig命令,加入到系统服务中。 但是对于的脚本的表头,需要增加如下内容

#!/bin/bash
#
# httpd Startup script for the Tomcat Server
#
# chkconfig: - 86 15
# description: The Tomcat Server is an efficient and extensible 
# server implementing the current tomcat standards.
# processname: tomcat8d

    2.加入服务中

       [root@CentOSTest init.d]# chkconfig --add tomcat8d 

       查询服务信息

[root@CentOSTest init.d]# chkconfig --list | grep tom
tomcat8d 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@CentOSTest init.d]#

              通过chkconfig命令加入服务,会在,如下目录中查询到信息(对于的0-6代表linux系统几种启动状态 )

           启动状态参照:/etc/inittab  文件

   3.修改对于服务,在那种状态下启动。

[root@CentOSTest init.d]# chkconfig --levels 35 tomcat8d on
[root@CentOSTest init.d]# chkconfig --list | grep tom
tomcat8d 0:off 1:off 2:off 3:on 4:off 5:on 6:off
[root@CentOSTest init.d]#

 

 4.重启电脑,测试tomcat是否正常启动

 

 

  服务正常启动,测试页面可能正常打开

 

只是写了个简答的启动代码,没有做考虑过多的情况。

 

 

 

 

posted @ 2018-01-13 14:01  Tooken  阅读(145)  评论(0编辑  收藏  举报