service XXX does not support chkconfig

service XXX does not support chkconfig

有时候为了方便管理,常常喜欢在Linux中将之安装为服务,然后就可以使用服务来管理。


#chkconfig --add resind

常常会出现

service resind does not support chkconfig

我们一般在脚本开头加入下面两句就好了(脚本名叫resind)
#vi /etc/init.d/resind

添加下面两句到 #!/bin/bash 之后。

# chkconfig: 2345 10 90
# description: resind


其中2345是默认启动级别,级别有0-6共7个级别。

  等级0表示:表示关机   

  等级1表示:单用户模式   

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

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

  等级4表示:不可用   

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

  等级6表示:重新启动

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




[root@picdata-1-1 init.d]# vi resind
#!/bin/bash
#chkconfig:2345 10 90
#description:resind
. /etc/init.d/functions
export JAVA_HOME=/application/jdk
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
export RESIN_HOME=/application/resin
StartPath='/application/resin/bin/httpd.sh'
ResinLog=/app/log/resinlog
[ ! -d $ResinLog ] && mkdir -p $ResinLog
resind()
{
        for id in oldboy
        do
                $StartPath -server $id $1 >> $ResinLog/resin_startup.log
                if [ $? -eq 0 ]
                  then
                        action "$1 $id resin..." /bin/true
                  else
                        action "$1 $id resin..." /bin/false
                fi
        done
"resind" 48L, 857C written
[root@ohost init.d]# chkconfig --add resind
[root@ohost init.d]# chkconfig --level 3 resind on
[root@ohost init.d]# chkconfig --list|grep resind
resind          0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@ohost init.d]#

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值