diff options
author | Symphorien Gibol <symphorien+git@xlumurb.eu> | 2020-04-02 12:00:00 +0000 |
---|---|---|
committer | Symphorien Gibol <symphorien+git@xlumurb.eu> | 2020-04-02 12:00:00 +0000 |
commit | 55d16d533446a815c5d266b72ff84bc97300fddc (patch) | |
tree | 864031e91f684539b6799867db6f1bba78406353 /nixos/modules/tasks | |
parent | ae6bdcc53584aaf20211ce1814bea97ece08a248 (diff) |
nixos/btrfs autoScrub: don't fail when scrub finishes successfully
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r-- | nixos/modules/tasks/filesystems/btrfs.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/tasks/filesystems/btrfs.nix b/nixos/modules/tasks/filesystems/btrfs.nix index f64493e1a3c7..c0ff28039b16 100644 --- a/nixos/modules/tasks/filesystems/btrfs.nix +++ b/nixos/modules/tasks/filesystems/btrfs.nix @@ -128,7 +128,10 @@ in Nice = 19; IOSchedulingClass = "idle"; ExecStart = "${pkgs.btrfs-progs}/bin/btrfs scrub start -B ${fs}"; - ExecStop = "${pkgs.btrfs-progs}/bin/btrfs scrub cancel ${fs}"; + # if the service is stopped before scrub end, cancel it + ExecStop = pkgs.writeShellScript "btrfs-scrub-maybe-cancel" '' + (${pkgs.btrfs-progs}/bin/btrfs scrub status ${fs} | ${pkgs.gnugrep}/bin/grep finished) || ${pkgs.btrfs-progs}/bin/btrfs scrub cancel ${fs} + ''; }; }; in listToAttrs (map scrubService cfgScrub.fileSystems); |