mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
2c49c32e72
This fixes #10231, without creating an own Dockerfile.
20 lines
522 B
Python
20 lines
522 B
Python
#!/usr/bin/env python3
|
|
# A supervisor event listener which terminates supervisord if any of its child
|
|
# processes enter the FATAL state.
|
|
# https://stackoverflow.com/a/37527488/119527
|
|
import os
|
|
import signal
|
|
|
|
from supervisor import childutils
|
|
|
|
def main():
|
|
while True:
|
|
headers, payload = childutils.listener.wait()
|
|
childutils.listener.ok()
|
|
if headers['eventname'] != 'PROCESS_STATE_FATAL':
|
|
continue
|
|
os.kill(os.getppid(), signal.SIGTERM)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|