service xxxx does not support chkconfig

本文介绍如何通过在脚本中添加特定注释使服务能在指定运行级别下自启动,并展示了正确的配置示例及mysql服务脚本的部分内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天想把自己启动服务的脚本放到/etc/init.d目录下,然后用chkconfig添加的自动启动项中去。结果报错了。

[root@huang ~]# chkconfig --level 2345 lepus on
service lepus does not support chkconfig

查了资料,也看了下mysql的启动脚本发现需要在脚本里加入下面的内存,才可以用chkconfig加入的自动启动项中去。

# chkconfig: 2345 65 35
# description: A os and database monitoring system.
注意:上面的注释的意思是,服务必须在运行级2,3,4,5下被启动或关闭,启动的优先级是65,关闭的优先级是35

添加上面选项后,再添加到启动项就OK了

[root@huang ~]# chkconfig --level 2345 lepus on
[root@huang ~]# 
[root@huang ~]# chkconfig --list|grep lepus
lepus              0:off    1:off    2:on    3:on    4:on    5:on    6:off

下面是mysql启动脚本的部分内容

#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind

# MySQL daemon start/stop script.

# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.

# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: A very fast and reliable SQL database engine.
MYSQL启动脚本的解析我之前写过一个文章

http://blog.youkuaiyun.com/gua___gua/article/details/46138101


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值