Skip to content
Snippets Groups Projects
Select Git revision
  • c63346fa6eba713d0d2e019cca85b08df2ed6820
  • v2018.2.x default
  • experimental
  • master
  • v2021.1.2-ffs
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • v2020.2.3-ffs
  • nrbffs/fastd-remove-delay
  • v2020.2.2-ffs
  • v2020.2.1-ffs
  • v2020.2-ffs
  • v2020.2.x
  • v2020.1.3-ffs
  • v2020.1.1-ffs
  • v2020.1-ffs
  • v2019.1.2-ffs
  • v2019.1.1-ffs
  • nrb/test-radv-filter
  • v2019.1-ffs
  • nrbffs/netgear-ex6120
  • v2021.1.2-ffs0.2
  • v2021.1.2-ffs0.1
  • v2021.1.1-ffs0.4
  • v2021.1.1-ffs0.3
  • v2021.1.1-ffs0.2
  • v2021.1.1-ffs0.1
  • v2021.1-ffs0.1
  • v2020.2.3-ffs0.3
  • v2020.2.3-ffs0.2
  • v2020.2.3-ffs0.1
  • v2020.2.2-ffs0.1
  • v2020.2.1-ffs0.1
  • v2020.2-ffs0.1
  • v2020.2
  • v2020.2.x-ffs0.1
  • v2020.1.3-ffs0.1
  • v2020.1.1-ffs0.1
  • v2020.1-ffs0.1
  • v2019.1.2-ffs0.1
  • v2019.1.1-ffs0.1
42 results

modules

Blame
  • Forked from firmware / FFS Gluon
    Source project has a limited visibility.
    gluon-check-connection 840 B
    #!/usr/bin/lua
    
    local unistd = require 'posix.unistd'
    local util = require 'gluon.util'
    local site = require 'gluon.site'
    
    local offline_flag_file = "/tmp/gluon_offline"
    local is_offline = true
    
    -- Check if domain-switch is scheduled
    if site.domain_switch() == nil then
    	-- Switch not applicable for current domain
    	os.exit(0)
    end
    
    -- Check reachability of pre-defined targets
    for _, ip in ipairs(site.domain_switch.connection_check_targets()) do
    	local exit_code = os.execute("ping -c 1 -w 10 " .. ip)
    	if exit_code == 0 then
    		is_offline = false
    		break
    	end
    end
    
    if is_offline then
    	-- Check if we were previously offline
    	if unistd.access(offline_flag_file) then
    		os.exit(0)
    	end
    	-- Create offline flag
    	local f = io.open(offline_flag_file, "w")
    	f:write(tostring(util.get_uptime()))
    	f:close()
    else
    	os.remove(offline_flag_file)
    end