mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-22 14:45:27 +00:00
nixos/terraria: Wait for daemon to stop
This commit is contained in:
parent
f0d6e22b7f
commit
943786eccf
|
@ -18,6 +18,16 @@ let
|
||||||
(boolFlag "secure" cfg.secure)
|
(boolFlag "secure" cfg.secure)
|
||||||
(boolFlag "noupnp" cfg.noUPnP)
|
(boolFlag "noupnp" cfg.noUPnP)
|
||||||
];
|
];
|
||||||
|
stopScript = pkgs.writeScript "terraria-stop" ''
|
||||||
|
#!${pkgs.runtimeShell}
|
||||||
|
|
||||||
|
if ! [ -d "/proc/$1" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
${getBin pkgs.tmux}/bin/tmux -S /var/lib/terraria/terraria.sock send-keys Enter exit Enter
|
||||||
|
${getBin pkgs.coreutils}/bin/tail --pid="$1" -f /dev/null
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
@ -124,10 +134,10 @@ in
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = "terraria";
|
User = "terraria";
|
||||||
Type = "oneshot";
|
Type = "forking";
|
||||||
RemainAfterExit = true;
|
GuessMainPID = true;
|
||||||
ExecStart = "${getBin pkgs.tmux}/bin/tmux -S /var/lib/terraria/terraria.sock new -d ${pkgs.terraria-server}/bin/TerrariaServer ${concatStringsSep " " flags}";
|
ExecStart = "${getBin pkgs.tmux}/bin/tmux -S /var/lib/terraria/terraria.sock new -d ${pkgs.terraria-server}/bin/TerrariaServer ${concatStringsSep " " flags}";
|
||||||
ExecStop = "${getBin pkgs.tmux}/bin/tmux -S /var/lib/terraria/terraria.sock send-keys Enter \"exit\" Enter";
|
ExecStop = "${stopScript} $MAINPID";
|
||||||
};
|
};
|
||||||
|
|
||||||
postStart = ''
|
postStart = ''
|
||||||
|
|
Loading…
Reference in a new issue