title: start-stop-daemon works at command line but doesn't work in /etc/init.d script
body: <p>I'm trying to get a starter script (for a ruby gem called ar_sendmail) working in /etc/init.d/ar_sendmail:</p>
  
  <pre><code>#! /bin/sh
  
  echo "in /etc/init.d/ar_sendmail"
  DIR=/home/max/work/e_learning_resource/trunk
  PATH=/var/lib/gems/1.8/bin
  DAEMON=/var/lib/gems/1.8/bin/ar_sendmail
  DAEMON_OPTS="-e production -d --batch-size 100 --delay 150"
  NAME=ar_sendmail
  DESC=ar_sendmail
  PID_FILE=/home/max/work/e_learning_resource/trunk/shared/log/ar_sendmail.pid
  
  
  test -x $DAEMON || exit 0
  set -e
  
  case "$1" in
    start)
          echo -n "Starting $DESC: "
          start-stop-daemon -d $DIR --start --quiet --pidfile $PID_FILE \
                  --exec $DAEMON -- $DAEMON_OPTS
          echo "$NAME."
          ;;
    stop)
          echo -n "Stopping $DESC: "
          kill -TERM `cat $PID_FILE`        
      rm $PID_FILE
          echo "$NAME."
          ;;
    restart)
          echo -n "Restarting $DESC: "
          kill -TERM `cat $PID_FILE`        
      rm $PID_FILE
          sleep 1
          start-stop-daemon -d $DIR --start --quiet --pidfile \
                  $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
          echo "$NAME."
          ;;
        *)
              N=/etc/init.d/$NAME
              echo "Usage: $N {start|stop|restart|reload}" &gt;&amp;2
              exit 1   
              ;;
      esac
  
      exit 0
  </code></pre>
  
  <p>It's blowing up on the start-stop-daemon line, saying "start-stop-daemon: not found".  But, when i plug the values into that line manually, and run it on the command line, it works.  </p>
  
  <p>My first thought was it was the shebang line but <code>#! /bin/sh</code> should be right shouldn't it?  It's definitely the right folder and what i use in my other /etc/init.d scripts.</p>
  
  <p>My second thought was that it's sudo related:  i'd been testing start-stop-daemon in non-sudo and running /etc/init.d/ar_sendmail in sudo mode.  But, i can run start-stop-daemon fine with sudo as well.</p>
  
  <p>Kind of stumped, any ideas?</p>