无法通过init.d正确启动aftpd

时间:2019-04-05 15:23:32

标签: debian embedded-linux init

我尝试在Debian 8开发板上启动aftpd

我已经安装了aftpd软件包,该软件包会自动创建以下/etc/init.d/aftpd起始脚本:

#! /bin/sh
#
# This is an init script for openembedded
# Copy it to /etc/init.d/atftpd and type
# > update-rc.d atftpd defaults 60
#


test -f /usr/sbin/atftpd || exit 0

test -d /srv/tftp || mkdir -p /srv/tftp

case "$1" in
  start)
    echo -n "Starting tftp daemon: atftpd"
    start-stop-daemon --start --quiet --exec /usr/sbin/atftpd --daemon --port 69 
    echo "."
    ;;
  stop)
    echo -n "Stopping tftp daemon: atftpd"
    start-stop-daemon --stop --quiet --exec /usr/sbin/atftpd
    echo "."
    ;;
  reload|force-reload)
    start-stop-daemon --stop --quiet --signal 1 --exec /usr/sbin/atftpd
    ;;
  restart)
    $0 stop
    sleep 1
        $0 start
    ;;
  *)
    echo "Usage: /etc/init.d/atftpd {start|stop|reload|restart|force-reload}"
    exit 1
esac

exit 0

但是当机器启动时,我收到以下错误消息:

Starting tftp daemon: atftpdstart-stop-daemon: unrecognized option '--daemon'
BusyBox v1.24.1 (2018-11-21 22:38:19 CET) multi-call binary.

Usage: start-stop-daemon [OPTIONS] [-S|-K] ... [-- ARGS...]
.

似乎start-stop-daemon为他带来了--daemon

为什么?

1 个答案:

答案 0 :(得分:0)

You have to use -- to separate arguments for the executable. Quoting the man page of start-stop-daemon:

Any arguments given after -- on the command line are passed unmodified to the program being started.

The arguments are passed "as usual". As there is whitespace right after /usr/sbin/atftpd, the rest is passed to start-stop-daemon in a standard way.