insserv:脚本已损坏

insserv:脚本已损坏

我正在关注这个链接

https://ubuntuforums.org/showthread.php?t=234588

用于设置我的 WOL 设置。这是我的脚本

猫唤醒网络配置

### BEGIN INIT INFO
#!/bin/bash
ethtool -s enp3s0 wol g
exit
### END INIT INFO

但我得到了这个

update-rc.d -f wakeonlanconfig defaults
insserv: Script wakeonlanconfig is broken: incomplete LSB comment.
insserv: missing `Provides:' entry: please add.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script wakeonlanconfig is broken: incomplete LSB comment.
insserv: missing `Provides:' entry: please add.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script wakeonlanconfig is broken: incomplete LSB comment.
insserv: missing `Provides:' entry: please add.

为什么?

答案1

有关 init.d 骨架的信息请检查这个问答在 Ubuntu SE 站点中

您需要在初始化脚本中实现这样的标头:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Sample_GT02 daemon startup script
# Description:       Sample Server for GT02 class 
### END INIT INFO

答案2

你的教程有点旧了:)

现在你的启动脚本应该有一个标题,如下所示:

### 开始初始化信息
# 提供:脚本名称
# 必需启动:$remote_fs $syslog
# 必需停止:$remote_fs $syslog
# 默认开始:2 3 4 5
# 默认停止:0 1 6
# 简短描述:在启动时启动守护进程
# 描述:启用守护进程提供的服务。
### 结束初始化信息

https://wiki.debian.org/LSBInitScripts了解更多信息

相关内容