init commit
This commit is contained in:
commit
181e6f681e
22 changed files with 940 additions and 0 deletions
38
scripts/zfs-healthcheck/service.nix
Executable file
38
scripts/zfs-healthcheck/service.nix
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
scriptPath = "${config.vars.homeDir}/nixos/scripts";
|
||||
after = [ "network.target" "NetworkManager.service" "uptime-kuma.service" ];
|
||||
environment = {
|
||||
VAR_IP = config.vars.privateIp;
|
||||
};
|
||||
in
|
||||
{
|
||||
systemd.services = {
|
||||
"zfs-uptime-kuma" = {
|
||||
inherit environment after;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
path = with pkgs; [ bash curl zfs jq ];
|
||||
script = ''
|
||||
bash ${scriptPath}/zfs-healthcheck/uptime-kuma.sh
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers = {
|
||||
"zfs-uptime-kuma" = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
partOf = [ "zfs-uptime-kuma.service" ];
|
||||
timerConfig = {
|
||||
Persistent = true; # Execute immediately if missed
|
||||
OnUnitActiveSec = "7m"; # Run every x minutes
|
||||
Unit = "zfs-uptime-kuma.service";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue