Linux &引用;启动-停止守护程序:无法统计";

Linux &引用;启动-停止守护程序:无法统计";,linux,bash,debian,start-stop-daemon,Linux,Bash,Debian,Start Stop Daemon,我有以下开始-停止脚本: NAME="examplestartstop" PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin" LOGFILE="/var/log/$NAME/start-stop-daemon.log" APP_DIR="/usr/bin" APP_BIN="tail -250f /var/log/apache2/error.log" USER="minecraft"

我有以下开始-停止脚本:

NAME="examplestartstop"
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
LOGFILE="/var/log/$NAME/start-stop-daemon.log"
APP_DIR="/usr/bin"
APP_BIN="tail -250f /var/log/apache2/error.log"
USER="minecraft"
GROUP="minecraft"

# Include functions
set -e
. /lib/lsb/init-functions

start() {
  echo "Starting '$NAME'... "
  start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec "$APP_DIR/$APP_BIN" $LOGFILE || true
  echo "done"
}
当我尝试运行脚本时,我得到以下输出:

$ ./test start
Starting 'examplestartstop'...
start-stop-daemon: unable to stat /usr/bin/tail -250f /var/log/apache2/error.log (No such file or directory)
done

我在
$APP\u DIR/$APP\u BIN
部分做错了什么?

您正在传递命令名和命令参数作为要执行的命令
start-stop-daemon
查找名为
/usr/bin/tail-250f/var/log/apache2/error.log的命令,该命令当然不存在。相反,您希望调用以下内容(忽略了不重要的部分):


(请注意--在命令及其参数之间)

执行此操作时,我收到一个错误启动停止守护进程:无法识别的选项“-250f”您是否遗漏了
--
$APP_ARGS
之间的空格?请为您的问题开始一个新问题。
APP_DIR="/usr/bin"
APP_BIN="tail"
APP_ARGS="-250f /var/log/apache2/error.log"
start-stop-daemon --start --exec "$APP_DIR/$APP_BIN" -- $APP_ARGS