2026-03-23 17:03:17 +02:00
|
|
|
import sys
|
2026-03-25 22:56:12 +02:00
|
|
|
import os
|
2026-03-23 17:03:17 +02:00
|
|
|
|
|
|
|
|
print("Checking for dead containers...")
|
|
|
|
|
|
|
|
|
|
l = [i for i in sys.stdin.read().split("\n") if i]
|
|
|
|
|
header, statuses = l[0], l[1:]
|
|
|
|
|
|
|
|
|
|
status_index = header.find('STATUS')
|
|
|
|
|
name_index = header.find('NAMES')
|
|
|
|
|
|
|
|
|
|
exit_code = 0
|
|
|
|
|
|
|
|
|
|
for i in statuses:
|
|
|
|
|
if not i[status_index:].startswith("Up "):
|
|
|
|
|
service_name = i[name_index:]
|
|
|
|
|
print(f"Crash detected in {service_name}")
|
2026-03-25 22:56:12 +02:00
|
|
|
print(f"docker logs for the container:\n")
|
|
|
|
|
os.system(f"docker logs {i.split(' ')[0]}")
|
|
|
|
|
print()
|
2026-03-23 17:03:17 +02:00
|
|
|
exit_code = 1
|
|
|
|
|
|
|
|
|
|
sys.exit(exit_code)
|