Created
July 11, 2017 08:56
-
-
Save metalefty/67c897b1e2b7723ad10269ec98762282 to your computer and use it in GitHub Desktop.
Amazon Route 53 Health CheckでYAMAHAルータを監視するためのLuaスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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