Skip to content

Instantly share code, notes, and snippets.

@metalefty
Created July 11, 2017 08:56
Show Gist options
  • Select an option

  • Save metalefty/67c897b1e2b7723ad10269ec98762282 to your computer and use it in GitHub Desktop.

Select an option

Save metalefty/67c897b1e2b7723ad10269ec98762282 to your computer and use it in GitHub Desktop.
Amazon Route 53 Health CheckでYAMAHAルータを監視するためのLuaスクリプト
tcp = rt.socket.tcp()
tcp:setoption("reuseaddr", true)
res, err = tcp:bind("0.0.0.0", 3800)
if not res and err then
print(err)
os.exit(1)
end
res, err = tcp:listen()
if not res and err then
print(err)
os.exit(1)
end
while 1 do
control = assert(tcp:accept())
control:settimeout(10)
sent, err = control:send("I'm alive.\n")
control:close()
rt.sleep(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment