mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	Refactored native-
This commit is contained in:
		
							
								
								
									
										20
									
								
								roles/docker-health-check/files/docker-health-check.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								roles/docker-health-check/files/docker-health-check.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| #!/bin/sh | ||||
| docker_ps_grep_unhealthy="$(docker ps --filter health=unhealthy --format '{{.Names}}')" | ||||
| docker_ps_grep_exited="$(docker ps --filter status=exited --format '{{.Names}}')" | ||||
| exitcode=0 | ||||
| if [ ! -z "$docker_ps_grep_unhealthy" ] | ||||
| then  | ||||
|    echo "Some docker containers are unhealthy: $docker_ps_grep_unhealthy" | ||||
|    exitcode=1 | ||||
| fi | ||||
| if [ ! -z "$docker_ps_grep_exited" ] | ||||
| then  | ||||
|    echo "Some docker containers exited: $docker_ps_grep_exited" | ||||
|    exitcode=2 | ||||
| fi | ||||
| if [ "$exitcode" -ne "0" ] | ||||
| then  | ||||
|    exit $exitcode | ||||
| fi | ||||
| echo "All docker containers are healthy." | ||||
| exit | ||||
		Reference in New Issue
	
	Block a user