A
Ashley Moran
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:aemon 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:rocHandler.new(decrypter_proc)
@server = HTTPServer.newPort => 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
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:aemon 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:rocHandler.new(decrypter_proc)
@server = HTTPServer.newPort => 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