zoukankan      html  css  js  c++  java
  • chkconfig命令

    检查、设置系统的各种服务。这是Red Hat公司遵循GPL规则所开发的程序,它可查询操作系统在每一个执行等级中会执行哪些系统服务,其中包括各类常驻服务。

    谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接。

    chkconfig version 1.3.49.5 - Copyright (C) 1997-2000 Red Hat, Inc.
    This may be freely redistributed under the terms of the GNU Public License.

    usage: chkconfig [--list] [--type <type>] [name]
    chkconfig --add <name>
    chkconfig --del <name>
    chkconfig --override <name>
    chkconfig [--level <levels>] [--type <type>] <name> <on|off|reset|resetpriorities>

    MySQL运行级别3的开启与关闭

    使用chkconfig查看运行级别:

    [root@xusx ~]# chkconfig --list mysqld
    mysqld 0:off 1:off 2:off 3:on 4:off 5:off 6:off
    [root@xusx ~]# chkconfig |grep mysqld
    mysqld 0:off 1:off 2:off 3:on 4:off 5:off 6:off

    =====================================================================================================

    使用chkconfig开启/关闭运行级别为3的mysqld

    [root@xusx ~]# chkconfig --level 3 mysqld off
    [root@xusx ~]# chkconfig |grep mysqld
    mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off

    [root@xusx ~]# chkconfig --level 3 mysqld on
    [root@xusx ~]# chkconfig --list mysqld
    mysqld 0:off 1:off 2:off 3:on 4:off 5:off 6:off

    =====================================================================================================

    #创建快捷方式

    =====================================================================================================

    [root@xusx ~]# cd /etc/init.d/

    ====>写一个脚本

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    [root@xusx init.d]# cat mysqld|head
    #!/bin/sh
    #
    # mysqld This shell script takes care of starting and stopping
    # the MySQL subsystem (mysqld).
    #
    # chkconfig: - 64 36
    # description: MySQL database server.
    # processname: mysqld
    # config: /etc/my.cnf
    # pidfile: /var/run/mysqld/mysqld.pid

    [root@xusx init.d]# vim mysqlx.sh

     #!/bin/sh

    #
    # mysqld This shell script takes care of starting and stopping
    # the MySQL subsystem (mysqld).
    #
    # chkconfig: - 64 36
    # description: MySQL database server.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    [root@xusx init.d]# cat iptables |head
    #!/bin/sh
    #
    # iptables Start iptables firewall
    #
    # chkconfig: 2345 08 92
    # description: Starts, stops and saves iptables firewall
    #
    # config: /etc/sysconfig/iptables
    # config: /etc/sysconfig/iptables-config

    [root@xusx init.d]# vim iptx.sh

    #!/bin/sh
    #
    # iptables Start iptables firewall
    #
    # chkconfig: 3 108 192
    # description: Starts, stops and saves iptables firewall

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    增加执行权限

    chmod +x fimename.sh

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    [root@xusx rc3.d]# chkconfig --add mysqlx.sh
    [root@xusx rc3.d]# ll|grep mysql
    lrwxrwxrwx. 1 root root 16 11月 4 00:13 K36mysqld -> ../init.d/mysqld
    lrwxrwxrwx. 1 root root 19 11月 15 17:01 K88mysqlx.sh -> ../init.d/mysqlx.sh
    [root@xusx rc3.d]# chkconfig |grep my
    mysqld 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
    mysqlx.sh 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭

    [root@xusx rc3.d]# chkconfig --add iptx.sh
    [root@xusx rc3.d]# ll|grep ipt
    lrwxrwxrwx. 1 root root 18 11月 15 06:34 K92iptables -> ../init.d/iptables
    lrwxrwxrwx. 1 root root 17 11月 15 17:09 S89iptx.sh -> ../init.d/iptx.sh
    [root@xusx rc3.d]# chkconfig |grep ipt
    iptables 0:关闭 1:关闭 2:启用 3:关闭 4:启用 5:启用 6:关闭
    iptx.sh 0:关闭 1:关闭 2:关闭 3:启用 4:关闭 5:关闭 6:关闭

    =====================================================================================================

  • 相关阅读:
    MapFile检索序列文件
    MapFile检索序列文件
    单词统计以序列格式输出
    单词统计以序列格式输出
    序列文件的读取和写入
    序列文件的读取和写入
    TypeError: list indices must be integers or slices, not tuple
    TypeError: list indices must be integers or slices, not tuple
    IndexError: tuple index out of range
    十四、数据库设计三范式
  • 原文地址:https://www.cnblogs.com/xusx/p/6064371.html
Copyright © 2011-2022 走看看