def stop(kill_arg=nil)
      if self.daemon_running?
        kill_pid(kill_arg || options[:kill])
        
        if until_true(MAX_START_TRIES) { self.daemon_stopped? }
          FileUtils.rm options[:pid_path] # Only kill if we stopped the daemon
          log "Daemonized process killed after term."
        else
          log "Failed to kill daemonized process"
          if options[:force]
            kill_pid(kill_arg || options[:kill], 'KILL')

            if until_true(MAX_START_TRIES) { self.daemon_stopped? }
              FileUtils.rm options[:pid_path] # Only kill if we stopped the daemon
              log "Daemonized process killed after kill."
            end
          end
        end
      else # not running
        log "No #{@name} processes are running"
        false
      end
    end
def stop(kill_arg=nil)
      if self.daemon_running?
        kill_pid(kill_arg || options[:kill])
        
        if until_true(MAX_START_TRIES) { self.daemon_stopped? }
          FileUtils.rm options[:pid_path] # Only kill if we stopped the daemon
          log "Daemonized process killed after term."
        else
          log "Failed to kill daemonized process"
          if options[:force]
            kill_pid(kill_arg || options[:kill], 'KILL')

            if until_true(MAX_START_TRIES) { self.daemon_stopped? }
              FileUtils.rm options[:pid_path] # Only kill if we stopped the daemon
              log "Daemonized process killed after kill."
            end
          end
        end
      else # not running
        log "No #{@name} processes are running"
        false
      end
    end
Stops a daemonized process