update-rc.d 不接受脚本文件的标头

update-rc.d 不接受脚本文件的标头

我有 beagleBoard,我想在启动时启动我的脚本(启动/重新启动)。所以,我运行了命令: update-rc.d GatewayStart.sh defaults

输出显示:标头被拒绝

    root@beaglebone:/etc/init.d# update-rc.d GatewayStart.sh defaults
    update-rc.d: using dependency based boot sequencing
    insserv: warning: script 'S18led_aging' missing LSB tags and overrides
    insserv: warning: script 'led_aging.sh' missing LSB tags and overrides
    insserv: There is a loop between service rmnologin and mountnfs if started
    insserv:  loop involving service mountnfs at depth 9
    insserv:  loop involving service networking at depth 8
    insserv: There is a loop between service led_aging and mountall if started
    insserv:  loop involving service mountall at depth 7
    insserv:  loop involving service checkfs at depth 6
    insserv:  loop involving service kbd at depth 8
    insserv: There is a loop between service led_aging and mountall-bootclean if started
    insserv:  loop involving service mountall-bootclean at depth 8
    insserv: There is a loop at service rmnologin if started
    insserv: There is a loop between service rmnologin and mountnfs-bootclean if started
    insserv:  loop involving service mountnfs-bootclean at depth 8
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Max recursions depth 99 reached
    insserv:  loop involving service saned at depth 1
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system 
facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv:  loop involving service urandom at depth 10
    insserv: There is a loop at service led_aging if started
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true!
    insserv: exiting now without changing boot order!
    update-rc.d: error: insserv rejected the script header

我已从其他脚本复制标头并更改提供标签中的名称。我的脚本是:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          GatewayStart.sh
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO
HOME="/home/debian"
{
export PATH="$PATH:$HOME/Gateway/usr/lib/jvm/jdk-7-oracle-armhf/bin"
#tar -zxvf jdk-7-oracle-armhf.tar.gz
echo $PATH
export JAVA_HOME="$HOME/Gateway/usr/lib/jvm/jdk-7-oracle-armhf"


case $1 in

stop)
echo "in stop"
$HOME/Gateway/apache-karaf-3.0.2/bin/stop
echo " stop done"
;; # case start end

*)
echo "start or default runs"
$JAVA_HOME/db/bin/stopNetworkServer&
sleep 15
echo "stopped derby"
$JAVA_HOME/db/bin/startNetworkServer&
db_count=0
while [ $db_count -ne 1 ]
do
   echo "derby is not started yet"
sleep 10
db_count="$($HOME/Gateway/usr/lib/jvm/jdk-7-oracle-armhf/db/bin/ij $HOME/Gateway/scripts.sql | grep -c selected)"
   echo $db_count
done
echo "                          DB started                                      "
echo "**********************************************************************************"
echo "                          Bringing UP GATEWAY                                     "
echo "**********************************************************************************"
echo $HOME

$HOME/Gateway/IPUUartInterface/build/UDP_UART "127.0.0.1" 30005 "127.0.0.1" 30004 /dev/ttyUSB0 4 x&
echo "command for UPD_UART ran"

$HOME/Gateway/apache-karaf-3.0.2/bin/stop
echo "if any previous instance is running , it is stopped"

$HOME/Gateway/apache-karaf-3.0.2/bin/start

sleep 20
a=1
b=1
while [ $b -lt 8 ] && [ $a -lt 9 ]
do
   echo $a
sleep 80
a="$($HOME/Gateway/apache-karaf-3.0.2/bin/client -a 8101 -h 127.0.0.1 -u karaf bundle:list | grep -c Active)"
   echo "now"
   echo $a
b=$((b+1))
done


echo "while loop is over"

if [ $a -ne 9 ]
then
    echo "karaf needs manual interruption"
    exit 0
fi


echo "***********************************************************************************"
echo "                          Karaf is Running...                                      "
echo "*********************************************************************************"

esac

exit 0

} >> $HOME/Reboot_log.txt

答案1

当我在谷歌上搜索这个错误时。它给了我两个选择:

a) 使用最新图像的闪存板 b) 将脚本 led_aging.sh 替换为 googlegroups 和博客上给出的脚本。

所以,我首先尝试了第二个选项,它成功了。我不知道 led_aging.sh 的目的是什么

实际的 led_aging.sh 是:

> #!/bin/sh
> # tary, 16:46 2013-4-22
> 
> x=$(/bin/ps -ef | /bin/grep "[l]ed_acc") if [ ! -n "$x" -a -x
> /usr/bin/led_acc ]; then  /usr/bin/led_acc & fi

新的 led_aging.sh 是:

> #!/bin/sh -e  
> ### BEGIN INIT INFO  
> # Provides: led_aging.sh  
> # Required-Start: $local_fs  
> # Required-Stop: $local_fs  
> # Default-Start: 2 3 4 5  
> # Default-Stop: 0 1 6  
> # Short-Description: Start LED aging  
> # Description: Starts LED aging (whatever that is)  
> ### END INIT INFO

> x=$(/bin/ps -ef | /bin/grep "[l]ed_acc")   if [ ! -n "$x" -a -x
> /usr/bin/led_acc ]; then     /usr/bin/led_acc &   fi

答案2

尝试这个

前 :::::::::::::::::::

#!/bin/bash
### BEGIN INIT INFO
# Provides:          GatewayStart.sh
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

::::::::::::::::::::::::::

后########################

#!/bin/bash
#
 GatewayStart init script

### BEGIN INIT INFO
# Provides:          GatewayStart.sh
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

这里的所有行都用 # 注释

我不知道为什么它要从某些行的开头删除这个#。

#

答案3

您的问题出在完全不同的文件上。它在您面前的许多错误消息中被命名为:led_aging.sh

它没有正确的 LSB 标头。 WWW 上的一些人提供了具有以下功能的版本:

相关内容