2026-02-15 21:11:33 +09:00
|
|
|
#!/usr/bin/env python3
|
2026-02-15 22:14:06 +09:00
|
|
|
"""Launch stats_server and contents_server as child processes."""
|
2026-02-15 21:11:33 +09:00
|
|
|
import subprocess, sys, signal
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
d = Path(__file__).parent
|
2026-02-15 22:44:36 +09:00
|
|
|
|
|
|
|
|
# Forward any CLI args (e.g. --config) to contents_server
|
|
|
|
|
extra_args = sys.argv[1:]
|
|
|
|
|
|
2026-02-15 21:11:33 +09:00
|
|
|
procs = [
|
|
|
|
|
subprocess.Popen([sys.executable, d / "stats_server.py"]),
|
2026-02-15 22:44:36 +09:00
|
|
|
subprocess.Popen([sys.executable, d / "contents_server.py"] + extra_args),
|
2026-02-15 21:11:33 +09:00
|
|
|
]
|
|
|
|
|
signal.signal(signal.SIGINT, lambda *_: [p.terminate() for p in procs])
|
|
|
|
|
signal.signal(signal.SIGTERM, lambda *_: [p.terminate() for p in procs])
|
2026-02-15 22:14:06 +09:00
|
|
|
print(f"Running stats_server (PID {procs[0].pid}) + contents_server (PID {procs[1].pid})")
|
2026-02-15 21:11:33 +09:00
|
|
|
for p in procs:
|
|
|
|
|
p.wait()
|