feat: restart minecraft server daily at 5:00 AM
This commit is contained in:
parent
6a4fb2e0c2
commit
ef6ccc2a6c
1 changed files with 17 additions and 1 deletions
|
@ -134,6 +134,23 @@
|
|||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
systemd.services.restart-minecraft-server = {
|
||||
description = "Restarts minecraft server docker container";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.docker}/bin/docker restart minecraft-server-mc-1";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.restart-minecraft-server = {
|
||||
description = "Restart minecraft server daily";
|
||||
timerConfig = {
|
||||
OnCalendar = "*-*-* 05:00:00";
|
||||
Persistent = true;
|
||||
};
|
||||
wantedBy = [ "timers.target" ];
|
||||
};
|
||||
|
||||
# Open ports in the firewall.
|
||||
networking.firewall.allowedTCPPorts = [ 2222 ];
|
||||
networking.firewall.allowedUDPPorts = [ 2222 ];
|
||||
|
@ -163,6 +180,5 @@
|
|||
#
|
||||
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||
system.stateVersion = "24.11"; # Did you read the comment?
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue