murmur service: log to journald by default
Save an option to log to file with new `logFile` option. As a side effect deprecate `pidfile` option and instead use systemd's RuntimeDirectory.
This commit is contained in:
parent
ecb99304ff
commit
f23c110692
|
@ -113,9 +113,10 @@ with lib;
|
|||
|
||||
# murmur
|
||||
(mkRenamedOptionModule [ "services" "murmur" "welcome" ] [ "services" "murmur" "welcometext" ])
|
||||
(mkRemovedOptionModule [ "services" "murmur" "pidfile" ] "Hardcoded to /run/murmur/murmurd.pid now")
|
||||
|
||||
# parsoid
|
||||
(mkRemovedOptionModule [ "services" "parsoid" "interwikis" ] [ "services" "parsoid" "wikis" ])
|
||||
(mkRemovedOptionModule [ "services" "parsoid" "interwikis" ] "Use services.parsoid.wikis instead")
|
||||
|
||||
# plexpy / tautulli
|
||||
(mkRenamedOptionModule [ "services" "plexpy" ] [ "services" "tautulli" ])
|
||||
|
|
|
@ -4,6 +4,7 @@ with lib;
|
|||
|
||||
let
|
||||
cfg = config.services.murmur;
|
||||
forking = cfg.logFile != null;
|
||||
configFile = pkgs.writeText "murmurd.ini" ''
|
||||
database=/var/lib/murmur/murmur.sqlite
|
||||
dbDriver=QSQLITE
|
||||
|
@ -12,8 +13,8 @@ let
|
|||
autobanTimeframe=${toString cfg.autobanTimeframe}
|
||||
autobanTime=${toString cfg.autobanTime}
|
||||
|
||||
logfile=/var/log/murmur/murmurd.log
|
||||
pidfile=${cfg.pidfile}
|
||||
logfile=${optionalString (cfg.logFile != null) cfg.logFile}
|
||||
${optionalString forking "pidfile=/run/murmur/murmurd.pid"}
|
||||
|
||||
welcometext="${cfg.welcometext}"
|
||||
port=${toString cfg.port}
|
||||
|
@ -78,10 +79,11 @@ in
|
|||
description = "The amount of time an IP ban lasts (in seconds).";
|
||||
};
|
||||
|
||||
pidfile = mkOption {
|
||||
type = types.path;
|
||||
default = "/run/murmur/murmurd.pid";
|
||||
description = "Path to PID file for Murmur daemon.";
|
||||
logFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
example = "/var/log/murmur/murmurd.log";
|
||||
description = "Path to the log file for Murmur daemon. Empty means log to journald.";
|
||||
};
|
||||
|
||||
welcometext = mkOption {
|
||||
|
@ -251,19 +253,13 @@ in
|
|||
after = [ "network-online.target "];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
RuntimeDirectory = "murmur";
|
||||
PIDFile = cfg.pidfile;
|
||||
Restart = "always";
|
||||
# murmurd doesn't fork when logging to the console.
|
||||
Type = if forking then "forking" else "simple";
|
||||
PIDFile = mkIf forking "/run/murmur/murmurd.pid";
|
||||
RuntimeDirectory = mkIf forking "murmur";
|
||||
User = "murmur";
|
||||
ExecStart = "${pkgs.murmur}/bin/murmurd -ini ${configFile}";
|
||||
PermissionsStartOnly = true;
|
||||
};
|
||||
|
||||
preStart = ''
|
||||
mkdir -p /var/log/murmur
|
||||
chown -R murmur /var/log/murmur
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue