diff options
author | Jo-Philipp Wich <jo@mein.io> | 2018-07-26 08:41:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-26 08:41:06 +0200 |
commit | 5c07c6fff37a9b363adb9be1c5bd29db44a1ad88 (patch) | |
tree | c56c35df7c99e9f9f0e4ddddbee0d4ba23448bda /contrib | |
parent | 69257be152a1582808af11853b0ddadd5904f7ed (diff) | |
parent | 5d0b720f8b002ac0dd0097beb63d3a88ce1c7faf (diff) |
Merge pull request #1761 from pmelange/ff_olsr_watchdog_del_tnl
ff_olsr_watchdog: delete stale tunnels
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog b/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog index 069f4c321..8ac803d30 100755 --- a/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog +++ b/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog @@ -23,6 +23,15 @@ if fs.access("/var/run/olsrd.pid") or fs.access("/var/run/olsrd4.pid") then if not wdgtime or ( systime - wdgtime ) > ( intv * 2 ) then os.execute("logger -t 'OLSR watchdog' 'Process died - restarting!'") + local tnls = io.popen("ip tunnel show | cut -d : -f 1") + while true do + tnl = tnls:read("*line") + if tnl == nil then break end + if string.find(tnl, "tnl_") == 1 then + os.execute(string.format("logger -t 'OLSR watchdog' 'Deleting stale tunnel %s'", tnl)) + os.execute(string.format("ip link del %s", tnl)) + end + end os.execute("/etc/init.d/olsrd restart") end end |