From: Serge Petrenko <sergepetrenko@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Serge Petrenko <sergepetrenko@tarantool.org>
Subject: [tarantool-patches] [PATCHv2] Detect when instance is run or restarted by tarantoolctl.
Date: Mon, 2 Jul 2018 17:48:22 +0300 [thread overview]
Message-ID: <20180702144822.4860-1-sergepetrenko@tarantool.org> (raw)
There are some hacks to know the instance was run by tarantoolctl,
none of them are too reliable, though. This patch introduces 2
environment variables set by tarantoolctl for the instance to
know when it's being run or restarted.
Closes: #3215
---
https://github.com/tarantool/tarantool/tree/sergepetrenko/gh-3215-tarantoolctl-detection
https://github.com/tarantool/tarantool/issues/3215
Changes in v2:
- scrape all and leave only the environment
variables setting in tarantoolctl
| 8 ++++++++
1 file changed, 8 insertions(+)
--git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
index b6b8e09c9..ecab0a0f1 100755
--- a/extra/dist/tarantoolctl.in
+++ b/extra/dist/tarantoolctl.in
@@ -514,6 +514,11 @@ local function start()
script_name = instance_path,
__defer_update = true
}
+
+ -- an env variable to tell when we the
+ -- instance is run under tarantoolctl
+ os.setenv('TARANTOOLCTL', 'true')
+
shift_argv(arg, 0, 2)
local success, data = pcall(dofile, instance_path)
-- if load fails - show last 10 lines of the log file and exit
@@ -593,6 +598,9 @@ local function restart()
end
stop()
fiber.sleep(1)
+ -- an env variable to tell when
+ -- the instance was restarted
+ os.setenv('TARANTOOL_RESTARTED', 'true')
start()
return 0
end
--
2.15.2 (Apple Git-101.1)
next reply other threads:[~2018-07-02 14:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-02 14:48 Serge Petrenko [this message]
2018-07-04 18:04 ` [tarantool-patches] " Konstantin Osipov
2018-07-05 6:58 ` Sergey Petrenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180702144822.4860-1-sergepetrenko@tarantool.org \
--to=sergepetrenko@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCHv2] Detect when instance is run or restarted by tarantoolctl.' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox