restart pppoe/l2tp in secrets changes

This commit is contained in:
Daniel Barlow 2024-08-30 20:49:27 +01:00
parent defbfce1fb
commit e745991b9d
2 changed files with 36 additions and 27 deletions

View File

@ -1,6 +1,7 @@
{ {
liminix liminix
, lib , lib
, svc
, output-template , output-template
, writeAshScript , writeAshScript
, writeText , writeText
@ -78,8 +79,7 @@ let
max redials = 2 # this gives 1 actual retry, as xl2tpd can't count max redials = 2 # this gives 1 actual retry, as xl2tpd can't count
''; '';
control = "/run/${name}/control"; control = "/run/${name}/control";
in service = longrun {
longrun {
inherit name; inherit name;
run = '' run = ''
mkdir -p /run/${name} mkdir -p /run/${name}
@ -90,4 +90,8 @@ longrun {
exec ${xl2tpd}/bin/xl2tpd -D -p /run/${name}/${name}.pid -c ${conf} -C ${control} exec ${xl2tpd}/bin/xl2tpd -D -p /run/${name}/${name}.pid -c ${conf} -C ${control}
''; '';
notification-fd = 10; notification-fd = 10;
};
in svc.secrets.subscriber.build {
watch = [ username password ];
inherit service;
} }

View File

@ -1,5 +1,6 @@
{ {
liminix liminix
, svc
, lib , lib
, output-template , output-template
, ppp , ppp
@ -66,8 +67,7 @@ let
"logfd" "2" "logfd" "2"
]; ];
timeoutOpt = if lcpEcho.interval != null then "-T ${builtins.toString (4 * lcpEcho.interval)}" else ""; timeoutOpt = if lcpEcho.interval != null then "-T ${builtins.toString (4 * lcpEcho.interval)}" else "";
in service = longrun {
longrun {
inherit name; inherit name;
run = '' run = ''
mkdir -p /run/${name} mkdir -p /run/${name}
@ -81,4 +81,9 @@ longrun {
then (10 + lcpEcho.failure * lcpEcho.interval) * 1000 then (10 + lcpEcho.failure * lcpEcho.interval) * 1000
else 60 * 1000; else 60 * 1000;
dependencies = [ interface ]; dependencies = [ interface ];
};
in svc.secrets.subscriber.build {
watch = [ username password ];
inherit service;
action = "restart-all";
} }