Sha256: cfde0124c23fb899766dec50159cd148292720613f0ca80f489d5cd768bf64bd
Contents?: true
Size: 1.7 KB
Versions: 4
Compression:
Stored size: 1.7 KB
Contents
#!/usr/bin/env ruby # Copyright (c) 2007, 2009 Samuel Williams. Released under the GNU GPLv3. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. require 'rubygems' require 'pathname' require 'rexec' require 'rexec/daemon' require 'webrick' require 'webrick/https' require 'xmlrpc/server' # Very simple XMLRPC daemon class TestDaemon < RExec::Daemon::Base @@var_directory = "/tmp/ruby-test/var" def self.run puts "Starting server..." @@rpc_server = WEBrick::HTTPServer.new( :Port => 11235, :BindAddress => "0.0.0.0", :SSLEnable => true, :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE, :SSLCertName => [["CN", WEBrick::Utils::getservername]]) @@listener = XMLRPC::WEBrickServlet.new @@listener.add_handler("add") do |amount| @@count ||= 0 @@count += amount end @@listener.add_handler("total") do @@count end @@rpc_server.mount("/RPC2", @@listener) $stdout.flush $stderr.flush @@rpc_server.start end def self.shutdown puts "Shutting down server..." @@rpc_server.shutdown end end TestDaemon.daemonize
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rexec-1.2.1 | test/daemon.rb |
rexec-1.1.12 | test/daemon.rb |
rexec-1.1.11 | test/daemon.rb |
rexec-1.1.10 | test/daemon.rb |