зеркало из https://github.com/github/memcached.git
Some refactoring on setup
This commit is contained in:
Родитель
057e3acd8f
Коммит
6db5ce0cf9
|
@ -1,30 +1,27 @@
|
|||
# TODO: find a better way to share this with tests
|
||||
UNIX_SOCKET_NAME = File.join('/tmp', 'memcached')
|
||||
|
||||
unless defined? UNIX_SOCKET_NAME
|
||||
HERE = File.dirname(__FILE__)
|
||||
UNIX_SOCKET_NAME = File.join('/tmp', 'memcached')
|
||||
# Kill memcached
|
||||
system("killall -9 memcached")
|
||||
|
||||
# Kill memcached
|
||||
system("killall -9 memcached")
|
||||
# Start memcached
|
||||
verbosity = (ENV['DEBUG'] ? "-vv" : "")
|
||||
log = "/tmp/memcached.log"
|
||||
memcached = ENV['MEMCACHED_COMMAND'] || 'memcached'
|
||||
system ">#{log}"
|
||||
|
||||
# Start memcached
|
||||
verbosity = (ENV['DEBUG'] ? "-vv" : "")
|
||||
log = "/tmp/memcached.log"
|
||||
memcached = ENV['MEMCACHED_COMMAND'] || 'memcached'
|
||||
system ">#{log}"
|
||||
|
||||
# TCP memcached
|
||||
(43042..43046).each do |port|
|
||||
cmd = "#{memcached} #{verbosity} -U 0 -p #{port} >> #{log} 2>&1 &"
|
||||
raise "'#{cmd}' failed to start" unless system(cmd)
|
||||
end
|
||||
# UDP memcached
|
||||
(43052..43053).each do |port|
|
||||
cmd = "#{memcached} #{verbosity} -U #{port} -p 0 >> #{log} 2>&1 &"
|
||||
raise "'#{cmd}' failed to start" unless system(cmd)
|
||||
end
|
||||
# Domain socket memcached
|
||||
(0..1).each do |i|
|
||||
cmd = "#{memcached} -M -s #{UNIX_SOCKET_NAME}#{i} #{verbosity} >> #{log} 2>&1 &"
|
||||
raise "'#{cmd}' failed to start" unless system(cmd)
|
||||
end
|
||||
# TCP memcached
|
||||
(43042..43046).each do |port|
|
||||
cmd = "#{memcached} #{verbosity} -U 0 -p #{port} >> #{log} 2>&1 &"
|
||||
raise "'#{cmd}' failed to start" unless system(cmd)
|
||||
end
|
||||
# UDP memcached
|
||||
(43052..43053).each do |port|
|
||||
cmd = "#{memcached} #{verbosity} -U #{port} -p 0 >> #{log} 2>&1 &"
|
||||
raise "'#{cmd}' failed to start" unless system(cmd)
|
||||
end
|
||||
# Domain socket memcached
|
||||
(0..1).each do |i|
|
||||
cmd = "#{memcached} -M -s #{UNIX_SOCKET_NAME}#{i} #{verbosity} >> #{log} 2>&1 &"
|
||||
raise "'#{cmd}' failed to start" unless system(cmd)
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче