diff --git a/lib/resty/auto-ssl/jobs/renewal.lua b/lib/resty/auto-ssl/jobs/renewal.lua index a1c7c57..3347056 100644 --- a/lib/resty/auto-ssl/jobs/renewal.lua +++ b/lib/resty/auto-ssl/jobs/renewal.lua @@ -133,7 +133,7 @@ local function do_renew(auto_ssl_instance) if not get_interval_lock("renew", auto_ssl_instance:get("renew_check_interval")) then return end - local renew_lock, new_renew_lock_err = lock:new("auto_ssl", { exptime = 1800, timeout = 0 }) + local renew_lock, new_renew_lock_err = lock:new("auto_ssl_settings", { exptime = 1800, timeout = 0 }) if new_renew_lock_err then ngx.log(ngx.ERR, "auto-ssl: failed to create lock: ", new_renew_lock_err) return diff --git a/lib/resty/auto-ssl/utils/shell_execute.lua b/lib/resty/auto-ssl/utils/shell_execute.lua index f01cd12..408db3e 100644 --- a/lib/resty/auto-ssl/utils/shell_execute.lua +++ b/lib/resty/auto-ssl/utils/shell_execute.lua @@ -17,6 +17,7 @@ return function(command) wait_time = wait_time + sleep_time if wait_time > max_time then + ngx.log(ngx.ERR, "auto-ssl: sockproc did not start in expected amount of time") break end end diff --git a/lib/resty/auto-ssl/utils/start_sockproc.lua b/lib/resty/auto-ssl/utils/start_sockproc.lua index c8449a8..7b8e1ae 100644 --- a/lib/resty/auto-ssl/utils/start_sockproc.lua +++ b/lib/resty/auto-ssl/utils/start_sockproc.lua @@ -2,7 +2,13 @@ local auto_ssl = require "resty.auto-ssl" local lock = require "resty.lock" local function start() + local _, set_false_err = ngx.shared.auto_ssl_settings:safe_set("sockproc_started", false) + if set_false_err then + ngx.log(ngx.ERR, "auto-ssl: failed to set shdict for sockproc_started: ", set_false_err) + end + ngx.log(ngx.NOTICE, "auto-ssl: starting sockproc") + local exit_status = os.execute("umask 0022 && " .. auto_ssl.lua_root .. "/bin/resty-auto-ssl/start_sockproc") -- Lua 5.2+ returns boolean. Prior versions return status code. if exit_status == 0 or exit_status == true then @@ -21,7 +27,7 @@ return function(force) end -- Add lock to ensure only a single start command is attempted at a time. - local start_lock, new_lock_err = lock:new("auto_ssl", { exptime = 600, timeout = 0 }) + local start_lock, new_lock_err = lock:new("auto_ssl_settings", { exptime = 600, timeout = 0 }) if new_lock_err then ngx.log(ngx.ERR, "Failed to create lock: ", new_lock_err) return