9951 explained code solutions for 126 technologies


nginx-luaHow to sleep in code


server {
  location / {
    content_by_lua_block {
      ngx.say(os.time())
      os.execute('sleep 1')
      ngx.say(os.time())
    }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.say

output given text to client

os.execute

executes given shell command

'sleep 1'

shell command to sleep for 1 second