diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 20:37:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 20:37:50 +0000 |
commit | c1f743ab2e4a7046d5500875a47d1f62c8624603 (patch) | |
tree | 709946d52f5f3bbaeb38be9e3f1d56d11f058237 /daemon/lua/distro-preconfig.lua.in | |
parent | Initial commit. (diff) | |
download | knot-resolver-c1f743ab2e4a7046d5500875a47d1f62c8624603.tar.xz knot-resolver-c1f743ab2e4a7046d5500875a47d1f62c8624603.zip |
Adding upstream version 5.7.1.upstream/5.7.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemon/lua/distro-preconfig.lua.in')
-rw-r--r-- | daemon/lua/distro-preconfig.lua.in | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/daemon/lua/distro-preconfig.lua.in b/daemon/lua/distro-preconfig.lua.in new file mode 100644 index 0000000..df155c2 --- /dev/null +++ b/daemon/lua/distro-preconfig.lua.in @@ -0,0 +1,19 @@ +-- SPDX-License-Identifier: GPL-3.0-or-later +log_target('syslog') -- assume running as OS service + +local ffi = require('ffi') +local id = os.getenv('SYSTEMD_INSTANCE') +if not id then + log_warn(ffi.C.LOG_GRP_SYSTEM, 'environment variable $SYSTEMD_INSTANCE not set') +else + -- Bind to control socket in run_dir + worker.control_path = '@run_dir@/control/' + local path = worker.control_path..id + local ok, err = pcall(net.listen, path, nil, { kind = 'control' }) + if not ok then + log_warn(ffi.C.LOG_GRP_NETWORK, 'bind to '..path..' failed '..err) + end +end + +-- Set cache location +rawset(cache, 'current_storage', 'lmdb://@systemd_cache_dir@') |