Advertisement
KelvinBouma

network reset

Jun 4th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. socket = require "socket"
  2. http = require "socket.http"
  3.  
  4. while true do
  5.     -- request to my own website and another one that should in theory always be online
  6.     response = http.request("http://cc.ordewittetafel.nl/cc")
  7.     response2 = http.request("http://example.com")
  8.  
  9.     -- if both sites are down, turn networking off, wait 10 seconds and turn it on again
  10.     if not response and not response2 then
  11.         os.execute("nmcli networking off")
  12.         socket.sleep(10)
  13.         os.execute("nmcli networking on")
  14.     end
  15.  
  16.     socket.sleep(180)
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement