Skip to content

Instantly share code, notes, and snippets.

@R-omk
Created January 24, 2020 06:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save R-omk/cfe0f3894064735797ff91be5fe4689f to your computer and use it in GitHub Desktop.
Save R-omk/cfe0f3894064735797ff91be5fe4689f to your computer and use it in GitHub Desktop.
Print output from tarantool to stdout
#!/usr/bin/env tarantool
local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock'
local os = require("os")
console = require('console')
console.on_start(function(self)
local status, reason
status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end)
if not status then
self:print(reason)
self.running = false
os.exit(1)
end
local res = self:eval(arg[1])
if res ~= nil then
print(res)
end
os.exit(0)
end)
console.on_client_disconnect(function(self) self.running = false end)
console.start()
os.exit(0)
@Totktonada
Copy link

Built-in alternative:

$ echo 'box.info.replication' | tarantoolctl enter <instance_name>
$ echo 'box.info.replication' | tarantoolctl connect <console_port / listen_port>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment