phpipam: add auto_remove script

This commit is contained in:
Sean Buckley 2021-07-12 14:37:57 -04:00
parent 530fadc247
commit 474b9d3c15
2 changed files with 21 additions and 17 deletions

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1625601352,
"narHash": "sha256-yCvbAC+gadcmW94KvXbTLWC5erkcKClQWX3G8k5O7u0=",
"lastModified": 1625919529,
"narHash": "sha256-Epn7JRegnKN81hQh4hGx1FOwfp3fBxDCIuSZDgqaBQ4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9d1350d9d56411b685ff3de5839ed6728b1bf808",
"rev": "cf59fbd539681f5ec2f4a82cf77aae7ab827a03f",
"type": "github"
},
"original": {
@ -23,11 +23,11 @@
},
"unstable": {
"locked": {
"lastModified": 1625533413,
"narHash": "sha256-D4Dp2qDmY3Y9/Mqxsha/18F0RsH3hPiHafG4bvTz2V4=",
"lastModified": 1625874246,
"narHash": "sha256-7cGgcysIXz/j/lRpJn7cNJjf0+k7sQ5EuGn62252Svw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "036dc0c709650e0c833822307af801f576d67273",
"rev": "45fc7d4a35c5343e58541a7847f6415654ccbb37",
"type": "github"
},
"original": {

View file

@ -21,6 +21,12 @@ let
'';
};
cronScripts = {
phpipam_ping = "exec ${pkgs.php}/bin/php ${phpipamHtdocs}/functions/scripts/pingCheck.php";
phpipam_remove_offline = "exec ${pkgs.php}/bin/php ${phpipamHtdocs}/functions/scripts/remove_offline_addresses.php";
phpipam_discovery = "exec ${pkgs.php}/bin/php ${phpipamHtdocs}/functions/scripts/discoveryCheck.php";
};
in
{
options.sconfig.phpipam = {
@ -51,20 +57,18 @@ in
config = lib.mkIf cfg.enable {
systemd.services = {
phpipam_ping = {
script = "exec ${pkgs.php}/bin/php ${phpipamHtdocs}/functions/scripts/pingCheck.php";
systemd.services = builtins.mapAttrs
(_: script: {
inherit script;
environment.IPAM_DATABASE_USER = "nginx";
serviceConfig.User = "nginx";
startAt = "*:0/15";
};
phpipam_discovery = {
script = "exec ${pkgs.php}/bin/php ${phpipamHtdocs}/functions/scripts/discoveryCheck.php";
environment.IPAM_DATABASE_USER = "nginx";
serviceConfig.User = "nginx";
startAt = "*:0/15";
};
};
})
cronScripts;
systemd.timers = builtins.mapAttrs
(_: _: { timerConfig.RandomizedDelaySec = 600; })
cronScripts;
services = {