zoukankan      html  css  js  c++  java
  • 46、linux shell命令,chkconfig

    1、说明

    chkconfig [--add][--del][--list][系统服务]

    chkconfig [--level <等级代号>][系统服务][on/off/reset]

        chkconfig provides a simple command-line tool for maintaining the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories.

    2、option

    add 增加所指定的系统服务,让chkconfig指令得以管理它,并同时在系统启动的叙述文件内增加相关数据。

    del 删除所指定的系统服务,不再由chkconfig指令管理,并同时在系统启动的叙述文件内删除相关数据。

    level<等级代号> 指定读系统服务要在哪一个执行等级中开启或关毕。

    3、其他

    1)运行级别就是操作系统当前正在运行的功能级别。这个级别从06,具有不同的功能。这些级别在/etc/inittab文件里指定。这个文件是init程序寻找的主要文件,最先运行的服务是那些放在/etc/rc.d目录下的文件。

    2)运行级别

    3:有网络支持的多用户模式

    5:有网络支持有X-Window支持的多用户模式

    4、示例

    chkconfig --list           列出所有的系统服务

    chkconfig --add httpd      增加httpd服务

    chkconfig --del httpd       删除httpd服务

    chkconfig --level 2345 httpd on  把httpd在运行级别为2345的情况下都是on(开启)的状态。

    chkconfig --level 5 sshd on

    5、执行类似 chkconfig rsync on 命令时会立即启动服务。但是,chkconfig --level 345 nscd off 不会自动停止 nscd 服务,而需要等待系统重启后才生效。希望马上启用或停止某个服务,可以使用service<service><action>命令;其中<service>为服务名称,<action>为操作动作,可以为start(启动)stop(停止)restart(重启)

    6、chkconfig命令如何增加一个服务:

    服务脚本必须存放在/etc/ini.d/目录下

    chkconfig --add servicename  //在chkconfig服务列表中增加此服务,该服务会在/etc/rc.d/rcN.d中被赋予K/S入口

    chkconfig --level 35 mysqld on

    修改服务的默认启动等级。

    参考

    1http://linux.die.net/man/8/chkconfig

    2http://www.cnblogs.com/Vegaslee/archive/2011/01/27/1946066.html

    3http://lugir.com/story/185.html

    4http://os.51cto.com/art/201006/207648.htm

    【5】 /etc/inittab的说明

    http://hi.baidu.com/lianxi1999/blog/item/75c9eb0f870549eeaa64570c.html

  • 相关阅读:
    IntelliJ IDEA 自定义 Generate POJOs.groovy 生成 POJO
    MyBatisPlus入门
    Angular中内置模块和自定义模块
    Angular跳转传值(get,动态路由,js)
    Angular路由配置
    Angular数据请求(get,post)
    Angular父子组件之间通讯传值
    Angular双向数据绑定
    Angular项目分析
    Angular环境搭建
  • 原文地址:https://www.cnblogs.com/mydomain/p/2194527.html
Copyright © 2011-2022 走看看