From 0a2103547f1c27ed79a81e3c3b735bf1bdf3d2a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Wed, 9 Jan 2019 13:13:55 +0100 Subject: [PATCH] nixos/smokeping: Remove bash wrapper, refactor. The bash wrapper process served no purpose, and systemd directly controlling the processes is more reliable / more responsive to systemctl commands. --- nixos/modules/services/networking/smokeping.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/networking/smokeping.nix b/nixos/modules/services/networking/smokeping.nix index 021368488a3f..6b550f4d0005 100644 --- a/nixos/modules/services/networking/smokeping.nix +++ b/nixos/modules/services/networking/smokeping.nix @@ -301,6 +301,7 @@ in serviceConfig = { User = cfg.user; Restart = "on-failure"; + ExecStart = "${cfg.package}/bin/smokeping --config=${configPath} --nodaemon"; }; preStart = '' mkdir -m 0755 -p ${smokepingHome}/cache ${smokepingHome}/data @@ -311,15 +312,23 @@ in ${cfg.package}/bin/smokeping --check --config=${configPath} ${cfg.package}/bin/smokeping --static --config=${configPath} ''; - script = "${cfg.package}/bin/smokeping --config=${configPath} --nodaemon"; }; systemd.services.thttpd = mkIf cfg.webService { wantedBy = [ "multi-user.target"]; requires = [ "smokeping.service"]; partOf = [ "smokeping.service"]; path = with pkgs; [ bash rrdtool smokeping thttpd ]; - script = ''thttpd -u ${cfg.user} -c "**.fcgi" -d ${smokepingHome} -p ${builtins.toString cfg.port} -D -nos''; - serviceConfig.Restart = "always"; + serviceConfig = { + Restart = "always"; + ExecStart = lib.concatStringsSep " " (lib.concatLists [ + [ "${pkgs.thttpd}/bin/thttpd" ] + [ "-u ${cfg.user}" ] + [ ''-c "**.fcgi"'' ] + [ "-d ${smokepingHome}" ] + [ "-p ${builtins.toString cfg.port}" ] + [ "-D -nos" ] + ]); + }; }; };