Sha256: 5730cbe265651ae59041f30585736a26a6a5987447e44ed5bfb1880d8ada0c8a

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

#!/usr/bin/env ruby231
# ypdmd -- ydim -- 12.01.2005 -- hwyss@ywesee.com

require 'yaml'
require 'syck'

require 'ydim/server'
require 'ydim/odba'
require 'logger'
require 'rclconf'
require 'drb'
require 'fileutils'
require 'odba/connection_pool'
require 'odba/drbwrapper'
require 'pg'
require 'dbi'
require 'dbi/version'
require 'dbd/Pg'

$0 = __FILE__

config = YDIM::Server.config
config.load(config.config)

ODBA.storage.dbi = ODBA::ConnectionPool.new(config.db_driver_url, 
	config.db_user, config.db_auth, :client_encoding => 'LATIN1')
ODBA.cache.setup

DRb.install_id_conv ODBA::DRbIdConv.new

log_file = config.log_file
if(log_file.is_a?(String))
	FileUtils.mkdir_p(File.dirname(log_file))
	log_file = File.open(log_file, 'a')
	at_exit { log_file.close }
end
logger = Logger.new(log_file)
logger.level = Logger.const_get(config.log_level)

server = YDIM::Server.new(config, logger)
server.extend(DRbUndumped)

if(config.detach)
	pidfile = '/var/run/ydimd.pid'
	File.open(pidfile, 'w') { |fh| fh.puts $$ }
	at_exit { File.unlink(pidfile) }
	Process.fork and exit!(0)
end

begin
	url = config.server_url
	url.untaint
	DRb.start_service(url, server)
	$SAFE = 1
	logger.info('start') { 
		sprintf("starting ydim-server on %s", config.server_url) }
	DRb.thread.join
rescue Exception => error
	logger.error('fatal') { error }
	raise
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ydim-1.1.1 bin/ydimd
ydim-1.1.0 bin/ydimd
ydim-1.0.9 bin/ydimd
ydim-1.0.8 bin/ydimd
ydim-1.0.7 bin/ydimd