3

I've written some code that should run as a server and wrapped it with Daemons as Daemons.run('myserver.rb'). When I run it as ./daemon.rb start it works but it is not informative at all, i.e. if myserver.rb throws an exception I will not even know my server did not start, Daemons will exit with exit code 0. Is there any way to tell Daemons to return a non-zero exit code if the wrapped script fails to start? Or perhaps another way for me to know if my server started successfully?

Andrii Yurchuk
  • 3,090
  • 6
  • 29
  • 40
  • Could you check for the pid file? – acw Jul 02 '13 at 09:54
  • Wondering same thing. This makes working with provisioning tools like Puppet very difficult as they rely on the exit codes to execute dependencies. – Patelify Aug 06 '14 at 06:23

1 Answers1

1

try

d=Daemons.run('myserver.rb')
exit d.applications.length > 0 ? 0 : 1