3
0
Fork 0
forked from mirrors/nixpkgs

znapzend service: options for logging/nodestroy/restart on failure

fixes #25960
This commit is contained in:
Silvan Mosberger 2017-05-21 12:57:16 +02:00 committed by Jörg Thalheim
parent 31a5e065b0
commit 3497ba5c3a
No known key found for this signature in database
GPG key ID: CA4106B8D7CC79FA

View file

@ -9,6 +9,26 @@ in
options = { options = {
services.znapzend = { services.znapzend = {
enable = mkEnableOption "ZnapZend daemon"; enable = mkEnableOption "ZnapZend daemon";
logLevel = mkOption {
default = "debug";
example = "warning";
type = lib.types.enum ["debug" "info" "warning" "err" "alert"];
description = "The log level when logging to file. Any of debug, info, warning, err, alert. Default in daemonized form is debug.";
};
logTo = mkOption {
type = types.str;
default = "syslog::daemon";
example = "/var/log/znapzend.log";
description = "Where to log to (syslog::<facility> or <filepath>).";
};
noDestroy = mkOption {
type = types.bool;
default = false;
description = "Does all changes to the filesystem except destroy";
};
}; };
}; };
@ -24,8 +44,9 @@ in
path = with pkgs; [ zfs mbuffer openssh ]; path = with pkgs; [ zfs mbuffer openssh ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.znapzend}/bin/znapzend"; ExecStart = "${pkgs.znapzend}/bin/znapzend --logto=${cfg.logTo} --loglevel=${cfg.logLevel} ${optionalString cfg.noDestroy "--nodestroy"}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
Restart = "on-failure";
}; };
}; };
}; };