LiteFS Cloud - backups and point in time restores for LiteFS

Finally got around to looking into this! Currently kinda just throwing something together with a little python script that I let copilot write most of, but a bit stuck with running it.

# every second, check if the `/litefs/.primary` file exists. If it does not,
# then the current node is the primary and Celery should be started, if not
# already running. If the file does exist, a different node is the primary
# and Celery should be stopped if it is currently running.
import os
import time

celery_running = False
while True:
    if os.path.exists('/litefs/.primary'):
        if celery_running:
            print('Stopping Celery')
            os.system('pkill -f "celery worker"')
            celery_running = False
    else:
        if not celery_running:
            print('Starting Celery')
            os.system('celery -A splashcat worker -l INFO -B &')
            celery_running = True
    time.sleep(1)
exec:
  # Only run migrations on candidate nodes.
  - cmd: "poetry run python manage.py migrate"
    if-candidate: true

  - cmd: "poetry run python scripts/run-celery-when-primary.py &"
    if-candidate: true

  # Then run the application server on all nodes.
  - cmd: "daphne -b 0.0.0.0 splashcat.asgi:application"

It seems like it gets stuck with the little python script despite the &, which I saw suggested on a stack overflow question about running stuff non-blocking. Does LiteFS do something special that makes this not work?