在运行Debian jessie的Pogoplug E02上会出现此问题 .

启动时,网络接口需要几秒钟才能联机 . “网络”脚本完成后需要短暂的延迟,以确保正常发生后续网络操作 .

我编写了以下脚本并使用update-rc.d插入它 . 脚本正确插入并在引导时以正确的顺序执行,在网络之后和依赖于netdelay的网络相关脚本之前执行

cat /etc/init.d/netdelay
#! /bin/sh
### BEGIN INIT INFO
# Provides:          netdelay
# Required-Start:    networking
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Delay 5s after eth0 up for Pogoplug
# Description:
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin

./lib/init/vars.sh
./lib/lsb/init-functions

        log_action_msg "Pausing for eth0 to come online"
        /bin/sleep 5
        log_action_msg "Continuing"

exit 0

当脚本在启动时执行时没有延迟 . 我在脚本中使用了sleep和/ bin / sleep,但都没有影响所需的延迟 . 启动日志显示如下 .

Thu Jan  1 00:00:25 1970: Configuring network interfaces...done.
Thu Jan  1 00:00:25 1970: INIT: Entering runlevel: 2
Thu Jan  1 00:00:25 1970: Using makefile-style concurrent boot in runlevel 2.
Thu Jan  1 00:00:26 1970: Starting SASL Authentication Daemon: saslauthd.
Thu Jan  1 00:00:29 1970: Pausing for eth0 to come online.
Thu Jan  1 00:00:30 1970: Continuing.
Thu Jan  1 00:00:33 1970: ntpdate updating system time.
Wed Feb  1 05:33:40 2017: Starting enhanced syslogd: rsyslogd.

(Pogoplug没有硬件时钟,也不知道在ntpdate运行之前的时间 . )

有人能看出问题所在吗?