Add Minecraft/Modded/mccheck.sh
Checks if the server is running. Starts server if not running. Set a cron job for every ~5min Systemd would work better but limits console access to RCON.
This commit is contained in:
		
							parent
							
								
									29e1755efa
								
							
						
					
					
						commit
						9adf5e080f
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		
							
								
								
									
										11
									
								
								Minecraft/Modded/mccheck.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Minecraft/Modded/mccheck.sh
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
if pgrep -u moddedmc java > /dev/null
 | 
			
		||||
then
 | 
			
		||||
    echo "Java process is running for user 'moddedmc'"
 | 
			
		||||
else
 | 
			
		||||
    echo "NO Java process running for user 'moddedmc'"
 | 
			
		||||
    echo "MCcheck.sh found that user moddedmc didnt have a java process running and will attempt to restart the server." >> /home/moddedmc/script.log
 | 
			
		||||
    bash /home/moddedmc/restartserver.sh
 | 
			
		||||
fi
 | 
			
		||||
exit
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue