phpipam: merge cron tasks

This commit is contained in:
Sean Buckley 2022-08-01 17:36:05 -04:00
parent d1426db0fe
commit d522460c08

View file

@ -25,12 +25,6 @@ let
''; '';
}; };
cronScripts = {
phpipam_ping = "exec ${pkgs.php74}/bin/php ${phpipamHtdocs}/functions/scripts/pingCheck.php";
phpipam_remove_offline = "exec ${pkgs.php74}/bin/php ${phpipamHtdocs}/functions/scripts/remove_offline_addresses.php";
phpipam_discovery = "exec ${pkgs.php74}/bin/php ${phpipamHtdocs}/functions/scripts/discoveryCheck.php";
};
in in
{ {
options.sconfig.phpipam = { options.sconfig.phpipam = {
@ -62,17 +56,18 @@ in
then { text = ""; } then { text = ""; }
else { source = cfg.configFile; }; else { source = cfg.configFile; };
systemd.services = builtins.mapAttrs systemd = {
(_: script: { services.phpipam-tasks = {
inherit script; script = ''
${pkgs.php74}/bin/php ${phpipamHtdocs}/functions/scripts/pingCheck.php
${pkgs.php74}/bin/php ${phpipamHtdocs}/functions/scripts/discoveryCheck.php
${pkgs.php74}/bin/php ${phpipamHtdocs}/functions/scripts/remove_offline_addresses.php
'';
serviceConfig.User = "nginx"; serviceConfig.User = "nginx";
startAt = "*:0/15"; startAt = "*:0/15";
}) };
cronScripts; timers.phpipam-tasks.timerConfig.RandomizedDelaySec = 600;
};
systemd.timers = builtins.mapAttrs
(_: _: { timerConfig.RandomizedDelaySec = 600; })
cronScripts;
services = { services = {
phpfpm.phpPackage = pkgs.php74; phpfpm.phpPackage = pkgs.php74;