在 ubuntu-18.04.3 版本中,使用 chkconfig 命令报错:
chkconfig –list
chkconfig: command not found
这段文本似乎是一个命令提示符,试图执行 chkconfig --list 命令,但返回了一个错误信息“chkconfig:command not found”。这个错误信息表明系统上没有安装 chkconfig 实用程序,或者它没有包含在系统的 PATH 变量中。
Ubuntu 中 chkconfig 已经被 sysv-rc-conf 所替代;
apt-get update
apt-get install sysv-rc-conf
sysv-rc-conf –list
通过 sysv-rc-conf 命令设置:
/etc/init.d 里面建立一个 test.sh (启动文件前面务必添加如下三行代码,否侧会提示 sysv-rc-conf 不支持):#!/bin/bash 选择Shell 环境
# chkconfig: 2345 55 25 #宝塔脚本中自动添加的并且测试能正常运行的
###sysv-rc-conf: 35 20 80 分别代表运行级别,启动优先权,关闭优先权
#description: test server 描述一下脚本
#!/bin/bash
# chkconfig: 2345 55 25
###sysv-rc-conf: 35 20 80
#description: test server
cd /root/test
bash start.sh
chmod +x /etc/init.d/test.sh
sysv-rc-conf:apt-get install sysv-rc-conf
sysv-rc-conf,开机自启动:cd /etc/init.d
sysv-rc-conf –add test.sh
sysv-rc-conf test.sh on