diff options
author | tdback <tyler@tdback.net> | 2024-12-25 11:26:35 -0500 |
---|---|---|
committer | tdback <tyler@tdback.net> | 2024-12-25 11:26:35 -0500 |
commit | 0483a25a9411fb25a11dec3ab0574a1827ee6acc (patch) | |
tree | 11fd1da087cace57d76fc4cf20eb0708c7b14ded /modules/scripts/zquota | |
parent | 9d69e79c9201457c61c55fa555d84af1e2a585de (diff) |
add checks for unset variables and quit on errors
Diffstat (limited to 'modules/scripts/zquota')
-rw-r--r-- | modules/scripts/zquota/default.nix | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/scripts/zquota/default.nix b/modules/scripts/zquota/default.nix index 449bf76..cfa08ee 100644 --- a/modules/scripts/zquota/default.nix +++ b/modules/scripts/zquota/default.nix @@ -7,6 +7,8 @@ let pkgs.writeShellScriptBin "zquota" '' #!/usr/bin/env bash + set -eu + if [ "$#" -ne 2 ]; then echo "failed to provide both a dataset and quota" >&2 exit 1 @@ -60,7 +62,7 @@ in environment.systemPackages = [ zquota ]; systemd.services."zquota" = { - description = "Perform and report routine quota checks on ZFS datasets"; + description = "Perform and report scheduled quota checks on ZFS datasets."; serviceConfig.Type = "oneshot"; script = strings.concatStringsSep "\n" <| mapAttrsToList ( dataset: quota: "/run/current-system/sw/bin/zquota ${dataset} ${builtins.toString quota}" |