+ server stops safely
This commit is contained in:
		@@ -13,6 +13,9 @@ docker run -d -p 27015:27015/tcp -p 27015:27015/udp -e WORKSHOP_COLLECTION_ID=12
 | 
				
			|||||||
tcp port for rcon, if you want to use it start with -usercon +rcon_password "yourPW"
 | 
					tcp port for rcon, if you want to use it start with -usercon +rcon_password "yourPW"
 | 
				
			||||||
udp port for game traffic
 | 
					udp port for game traffic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## access console
 | 
				
			||||||
 | 
					docker exec -it CONTAINER ./home/steam/gmodserver console
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## environment variables
 | 
					## environment variables
 | 
				
			||||||
If set every workshop item at the collection is added as forced, that means its automatically downloaded on connecting. Don't add collections with maps here just like weapons aso.
 | 
					If set every workshop item at the collection is added as forced, that means its automatically downloaded on connecting. Don't add collections with maps here just like weapons aso.
 | 
				
			||||||
WORKSHOP_COLLECTION_ID=
 | 
					WORKSHOP_COLLECTION_ID=
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,9 +45,22 @@ fi
 | 
				
			|||||||
sed -i 's/! fn_prompt_yn "Continue?" Y/[ "1" != "1" ]/' "${STEAM_PATH}/lgsm/functions/command_console.sh"
 | 
					sed -i 's/! fn_prompt_yn "Continue?" Y/[ "1" != "1" ]/' "${STEAM_PATH}/lgsm/functions/command_console.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#start server
 | 
					#start server
 | 
				
			||||||
 | 
					IS_RUNNING="true"
 | 
				
			||||||
 | 
					function stopServer {
 | 
				
			||||||
 | 
						echo "stopping server..."
 | 
				
			||||||
 | 
						cd "${STEAM_PATH}"
 | 
				
			||||||
 | 
						pkill -2 srcds_linux
 | 
				
			||||||
 | 
						pkill -2 srcds_run
 | 
				
			||||||
 | 
						echo "server stopped!"
 | 
				
			||||||
 | 
						echo "stopping entrypoint..."
 | 
				
			||||||
 | 
						IS_RUNNING="false"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
./gmodserver start
 | 
					./gmodserver start
 | 
				
			||||||
 | 
					trap stopServer SIGTERM
 | 
				
			||||||
#trap & show console
 | 
					echo "Server is running, waiting for SIGTERM"
 | 
				
			||||||
trap 'pkill -15 srcds_run' SIGTERM
 | 
					while [ "$IS_RUNNING" = "true" ]
 | 
				
			||||||
./gmodserver console
 | 
					do
 | 
				
			||||||
# If in background created and wait "$!" => terminal never started -> container exit right after
 | 
						sleep 1s
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					echo "entrypoint stopped"
 | 
				
			||||||
 | 
					exit 0
 | 
				
			||||||
		Reference in New Issue
	
	Block a user