Skip to content
Snippets Groups Projects
Commit 8852434e authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge remote-tracking branch 'origin/gh-652-non_def_path'

parents 23ca6939 2f2b5852
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,27 @@ local fiber = require 'fiber' ...@@ -106,6 +106,27 @@ local fiber = require 'fiber'
ffi.cdef[[ int kill(int pid, int sig); ]] ffi.cdef[[ int kill(int pid, int sig); ]]
configs = {
system = nil,
user = os.getenv('HOME') .. '/.config/tarantool/tarantool',
}
if not fio.stat(configs.user) then
configs.user = nil
end
config_list = {
'/etc/sysconfig/tarantool',
'/etc/default/tarantool',
'/usr/local/etc/tarantool/tarantool',
}
for _, c in pairs(config_list) do
if fio.stat(c) then
configs.system = c
break
end
end
local available_commands = { local available_commands = {
'start', 'start',
...@@ -119,6 +140,9 @@ local available_commands = { ...@@ -119,6 +140,9 @@ local available_commands = {
local function usage() local function usage()
log.error("Usage: %s {%s} instance_name", log.error("Usage: %s {%s} instance_name",
arg[0], table.concat(available_commands, '|')) arg[0], table.concat(available_commands, '|'))
for c, f in pairs(configs) do
log.error("Config [%6s]: %s", c, f)
end
os.exit(1) os.exit(1)
end end
...@@ -164,10 +188,19 @@ end ...@@ -164,10 +188,19 @@ end
shift_argv(arg, 0, 2) shift_argv(arg, 0, 2)
if fio.stat('/etc/sysconfig/tarantool') then local instance_lua = nil
dofile('/etc/sysconfig/tarantool')
elseif fio.stat('/etc/default/tarantool') then for _, c in pairs({'user', 'system'}) do
dofile('/etc/default/tarantool') dofile(configs[c])
if instance_dir then
instance_lua = fio.pathjoin(instance_dir, instance .. '.lua')
if fio.stat(instance_lua) then
log.info('Found %s.lua in %s', instance, instance_dir)
break
end
end
instance_dir = nil
instance_lua = nil
end end
if default_cfg == nil then if default_cfg == nil then
...@@ -176,6 +209,7 @@ end ...@@ -176,6 +209,7 @@ end
if instance_dir == nil then if instance_dir == nil then
instance_dir = '/etc/tarantool/instances.enabled' instance_dir = '/etc/tarantool/instances.enabled'
instance_lua = fio.pathjoin(instance_dir, instance .. '.lua')
end end
default_cfg.pid_file = default_cfg.pid_file and default_cfg.pid_file or "/var/run/tarantool" default_cfg.pid_file = default_cfg.pid_file and default_cfg.pid_file or "/var/run/tarantool"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment