From: Ashley Moran Date: 2006-12-13T23:08:13+09:00 Subject: How do I run WEBrick as a daemon? Hi I'm trying to make a simple web server to provide decryption to a C# app that can't access OpenSSL libraries. It has to run on a FreeBSD server so I need to make it run as a daemon, but I can't work out how. The skeleton of the code is below. I've noticed there is a WEBrick::Daemon class but I can't figure out how to use it. I've tried using script/server from Rails as a template but it's pretty complex. Can anyone offer some hints? Thanks in advance Ashley #!/usr/bin/env ruby class PasswordServer include WEBrick def initialize(port) decrypter_proc = lambda { |request, response| # blah } decrypt = HTTPServlet::ProcHandler.new(decrypter_proc) @server = HTTPServer.new(:Port => port) @server.mount("/decrypt", decrypt) end def start trap("INT") { server.shutdown } trap("TERM") { server.shutdown } server.start end end if $0 == __FILE__ PasswordServer.new(2999).start end