Sha256: 0f5c2b16be5eb1bc88017b3e660469a0a3874b921bc260aa72e78812b91bd49c
Contents?: true
Size: 765 Bytes
Versions: 4
Compression:
Stored size: 765 Bytes
Contents
#!/usr/bin/env ruby require 'process/daemon' require 'webrick' require 'webrick/https' require 'xmlrpc/server' # Very simple XMLRPC daemon class XMLRPCDaemon < Process::Daemon def base_directory File.join(__dir__, "tmp") end def startup puts "Starting server..." @rpc_server = WEBrick::HTTPServer.new( :Port => 31337, :BindAddress => "0.0.0.0" ) @listener = XMLRPC::WEBrickServlet.new @listener.add_handler("fourty-two") do |amount| "Hello World" end @rpc_server.mount("/RPC2", @listener) begin @rpc_server.start rescue Interrupt puts "Daemon interrupted..." ensure @rpc_server.shutdown end end def shutdown puts "Stopping the RPC server..." @rpc_server.stop end end XMLRPCDaemon.daemonize
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
process-daemon-0.5.3 | test/daemon.rb |
process-daemon-0.5.1 | test/daemon.rb |
process-daemon-0.5.0 | test/daemon.rb |
process-daemon-0.3.0 | test/daemon.rb |