Skip to content

Commit

Permalink
health: add a 75s delay when applying a new config
Browse files Browse the repository at this point in the history
Signed-off-by: John Crispin <john@phrozen.org>
  • Loading branch information
blogic committed Mar 25, 2022
1 parent fb6db0f commit 9ac9f7e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion renderer/templates/metric/health.uc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{% if (!health) return %}
{%
services.set_enabled("uhealth", true);
if (!health)
return;
%}

# Health configuration
set ustats.health.interval={{ health.interval }}
2 changes: 2 additions & 0 deletions renderer/ucentral.uc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ try {
'rm /tmp/dnsmasq.conf',
'cp /etc/config-shadow/wireless /etc/config/wireless',
'/etc/init.d/wpad restart',
'/etc/init.d/uhealth stop',
'touch /tmp/ucentral.health',
'touch /tmp/dnsmasq.conf' ])
system(cmd);

Expand Down
5 changes: 5 additions & 0 deletions system/health.uc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ let fs = require("fs");
let uci = require("uci");
let ubus = require("ubus");

if (length(fs.stat('/tmp/ucentral.health')))
sleep(75000);

fs.unlink('/tmp/ucentral.health');

state = {
unit: {},
interfaces: {}
Expand Down

0 comments on commit 9ac9f7e

Please sign in to comment.