Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ubus = require 'ubus'
- local conn = ubus.connect()
- if not conn then
- error('Failed to connect to ubusd')
- end
- local interface = 'ttk'
- local status = conn:call('network.interface.' .. interface, 'status', { })
- if status.up then
- -- argh, there is no RAII...
- conn:close()
- return
- end
- local logStatus = conn:call('log', 'write', { event = interface .. ' is down. Trying to restart...' })
- -- this from official wiki. Maybe it is outdated
- -- status = conn:call('network.interface.' .. interface, 'up', { })
- -- found in /sbin/ifup script
- status = conn:call('network.interface', 'up', { interface = '' .. interface })
- -- print(tostring(status))
- -- logStatus = conn:call('log', 'write', { event = 'interface.up = ' .. status })
- conn:close()
Add Comment
Please, Sign In to add comment