zoukankan      html  css  js  c++  java
  • ubuntu下使用 chkconfig 是一种习惯

    ubuntu下使用 chkconfig 是一种习惯

    习惯了chkconfig命令, 闲来写了个脚本模拟下, 步骤很简单。 如下:

    第一步, 安装sysv-rc-conf

    sudo apt install sysv-rc-conf

    第二步, 将如下脚本放于/usr/sbin目录下

    gord@gord:/usr/sbin$ cat chkconfig 
    #!/usr/bin/perl
    
    use strict;
    #use warnings;
    
    my $param1 = $ARGV[0];
    my $param2 = $ARGV[1];
    
    if ( defined $param2 ){
        if ( $param1 =~ /list/ ){
            system("sysv-rc-conf --list $param2");
        }elsif( $param2 eq 'on' ){
            system("sysv-rc-conf --level 2345 $param1 on");
            system("sysv-rc-conf --list $param1");
        }elsif( $param2 eq 'off' ){
            system("sysv-rc-conf --level 2345 $param1 off");
            system("sysv-rc-conf --list $param1");
            }else{
                print("Usage: chkconfig < option > | --list | [ service_name [ command  < on | off > ] ]
    ");
                exit(1);
        }
    }else{
        system("sysv-rc-conf --list $param2");

    第三步, 赋予权限

    chmod 755 chkconfig

    使用下,看看效果

    gord@gord:/usr/sbin$ chkconfig --list postfix
    postfix      0:off    1:off    2:on    3:on    4:on    5:on    6:off
    本文系作者原创,转载请注明出处。如您阅读的是转载,请最好再看下原文,原文随时会更新和勘误的。

    @Gordon_chang
    1997年毕业于北京联合大学,先后在中国万网,新媒传信,亚信等公司工作,现在在一家创业型公司担任云计算与大数据运维方面的 PM & Engineer。 专注于以下四个领域: 分布式存储 分布式数据库 云计算 大数据 重点通过技术架构与性能优化(底层)实现基于私有云的大数据平台能力

  • 相关阅读:
    模拟退火求二维费马点
    二叉查找树
    Linux中让普通用户拥有超级用户的权限
    python 正则表达式应用——缩写词扩充
    解决单链表中的环问题
    python数学函数
    train,dev,test数据集作用
    朴素贝叶斯法(二)——基本方法
    生成模型与判别模型
    ImportError: cannot import name wordnet
  • 原文地址:https://www.cnblogs.com/gordonchang/p/6647591.html
Copyright © 2011-2022 走看看