minecraft: Add automatic restart scheduling
This starts/stops the server at 2 pm and 4 am respectively. This should hopefully fix some of the issues caused by shoddy programming.
This commit is contained in:
		
							parent
							
								
									6bc37ebdae
								
							
						
					
					
						commit
						a66eac3b17
					
				
					 1 changed files with 27 additions and 0 deletions
				
			
		|  | @ -102,4 +102,31 @@ in { | |||
|       "${whitelist}:/var/lib/minecraft/whitelist.json:ro" | ||||
|     ]; | ||||
|   }; | ||||
| 
 | ||||
|   systemd.timers.podman-minecraft-voor-kia-off = { | ||||
|     description = "Turns off the minecraft server every day at 4 am"; | ||||
|     wantedBy = [ "podman-minecraft-voor-kia.service" ]; | ||||
|     timerConfig = { | ||||
|       Unit = "podman-minecraft-voor-kia-starter@stop.service"; | ||||
|       OnCalendar = "04:00:00"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   systemd.timers.podman-minecraft-voor-kia-on = { | ||||
|     description = "Turns on the minecraft server every day at 2 pm"; | ||||
|     wantedBy = [ "podman-minecraft-voor-kia.service" ]; | ||||
|     timerConfig = { | ||||
|       Unit = "podman-minecraft-voor-kia-starter@start.service"; | ||||
|       OnCalendar = "14:00:00"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   systemd.services."podman-minecraft-voor-kia-starter@" = { | ||||
|     description = "Unit to stop/start the minecraft server"; | ||||
|     serviceConfig = { | ||||
|       ExecStart = | ||||
|         "${pkgs.systemd}/bin/systemctl %i podman-minecraft-voor-kia.service"; | ||||
|       Type = "oneshot"; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue