"start-stop-daemon: unable to stat"

15,841

You are passing the command name and the command arguments as the command to execute. start-stop-daemon looks for a command named /usr/bin/tail -250f /var/log/apache2/error.log which does not exist of course. Instead you want to call something like (unimportant parts left out):

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

(note the -- between the command and its arguments)

Share:
15,841
Florence V. Lee
Author by

Florence V. Lee

Updated on June 17, 2022

Comments

  • Florence V. Lee
    Florence V. Lee over 1 year

    i have the following start-stop-script:

    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"
    }
    

    When i try to run the script i get the following output:

    $ ./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
    

    What did i done wrong on the $APP_DIR/$APP_BIN part?

  • Manu Viswam
    Manu Viswam almost 10 years
    when i do this i get an error start-stop-daemon: unrecognized option '---250f'
  • scai
    scai almost 10 years
    Did you miss the space between -- and $APP_ARGS? And please start a new question for your issue.