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.
This commit is contained in:
parent
f0f12b2ad0
commit
0a2103547f
@ -301,6 +301,7 @@ in
|
|||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
ExecStart = "${cfg.package}/bin/smokeping --config=${configPath} --nodaemon";
|
||||||
};
|
};
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -m 0755 -p ${smokepingHome}/cache ${smokepingHome}/data
|
mkdir -m 0755 -p ${smokepingHome}/cache ${smokepingHome}/data
|
||||||
@ -311,15 +312,23 @@ in
|
|||||||
${cfg.package}/bin/smokeping --check --config=${configPath}
|
${cfg.package}/bin/smokeping --check --config=${configPath}
|
||||||
${cfg.package}/bin/smokeping --static --config=${configPath}
|
${cfg.package}/bin/smokeping --static --config=${configPath}
|
||||||
'';
|
'';
|
||||||
script = "${cfg.package}/bin/smokeping --config=${configPath} --nodaemon";
|
|
||||||
};
|
};
|
||||||
systemd.services.thttpd = mkIf cfg.webService {
|
systemd.services.thttpd = mkIf cfg.webService {
|
||||||
wantedBy = [ "multi-user.target"];
|
wantedBy = [ "multi-user.target"];
|
||||||
requires = [ "smokeping.service"];
|
requires = [ "smokeping.service"];
|
||||||
partOf = [ "smokeping.service"];
|
partOf = [ "smokeping.service"];
|
||||||
path = with pkgs; [ bash rrdtool smokeping thttpd ];
|
path = with pkgs; [ bash rrdtool smokeping thttpd ];
|
||||||
script = ''thttpd -u ${cfg.user} -c "**.fcgi" -d ${smokepingHome} -p ${builtins.toString cfg.port} -D -nos'';
|
serviceConfig = {
|
||||||
serviceConfig.Restart = "always";
|
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" ]
|
||||||
|
]);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user