14 lines
784 B
Python
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.')
|