Files
compras/scripts/stop-owned-presentation-staging.py
T
nala 47649bd46c
tests / ci (push) Canceled after 0s
commit compras1 3011
2026-11-30 09:33:36 +02:00

14 lines
784 B
Python

"""Stop only this delivery's no-longer-needed loopback rehearsal process group."""
from pathlib import Path
import os
import signal
pidfile = Path('/var/www/compras-deploy/demonstration-20261129/staging-pid')
pid = int(pidfile.read_text())
assert pid == 1173215 and os.getpgid(pid) == pid
assert Path('/proc/1173216/cwd').resolve() == Path('/var/www/compras-deploy/releases/presentation-20261129')
assert Path('/proc/1173216/cmdline').read_bytes().split(b'\0')[:5] == [b'php', b'-S', b'127.0.0.1:49815', b'-t', b'public']
assert Path('/proc/'+str(pid)+'/cmdline').read_bytes().split(b'\0')[:7] == [b'runuser', b'-u', b'www-data', b'--', b'php', b'-S', b'127.0.0.1:49815']
os.killpg(pid, signal.SIGTERM)
print('Owned loopback staging stopped; selected public application preserved.')