serviced does not support chkconfig

不怎么写service脚本,一写就出现了 does not support chkconfig,原来是忘了一行,记录一下。

下面是一个自己写的一个测试service脚本,testd

#!/bin/bash
#chkconfig: 2345 30 90
#description: myservice testd...
#test initd
start(){
    echo "start testd..."
    cd /home/xl/test/test
    chmod 755 prog.sh
    ./prog.sh &
    echo "test start successful ..."
}
stop(){
    pid=`ps -ef|grep "prog"|grep -v "grep"|awk '{print $2}'`
    if [ "$pid" == "" ]; then
        echo "No prog pid alive ..."
    else
        echo "now ,kill pid $pid ..."
        kill $pid
        echo "prog stopd successful ..."
    fi
}
status(){
    pid=`ps -ef|grep "prog"|grep -v "grep"|awk '{print $2}'`
        if [ "$pid" == "" ]; then
                echo "prog is stopped ..."
        else
                echo "prog is runing ..."
        fi
}
restart(){
    stop
    start
}
#execute by input command
case "$1" in
    start)
        start
    ;;
    stop)
        stop
    ;;
    status)
        status
    ;;
    restart)
        restart
    ;;
    *)
        echo $"Usages: $0 {start|stop|status|restart}"
        exit 1
esac
[root@xl~]#systemctl enable testd

testd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig testd on

其中2345是默认启动级别,级别有0-6共7个级别。就是在哪个级别里启动该服务

  等级0表示:表示关机   

  等级1表示:单用户模式   

  等级2表示:无网络连接的多用户命令行模式   

  等级3表示:有网络连接的多用户命令行模式   

  等级4表示:不可用   

  等级5表示:带图形界面的多用户模式   

  等级6表示:重新启动

30是启动优先级,90是停止优先级,优先级范围是0-100,数字越大,优先级越低。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值