Interview Prep/Python for DevOps/Kubernetes, Docker, SSH & fleet automation

A script needs to run a long command on remote hosts and survive your laptop disconnecting. How do you design it?

IntermediateScenarioKubernetes, Docker, SSH & fleet automation
Answer

Situation read → Long-running remote work tied to a local SSH session dies with the session.

What I'd do →

  1. Do not keep the work in the SSH session: start it as a systemd transient unit (systemd-run --unit=reindex ...) or inside tmux/nohup, and poll status.
  2. Better: run the orchestration from a CI job or a bastion, not a laptop.
  3. On AWS, SSM Run Command keeps running independent of your client and stores output.

Why → Remote work should not depend on the controller's network.

Interview tip → systemd-run is a neat, less-known answer.

All Python for DevOps questions Roadmap: Python for automation

More on Kubernetes, Docker, SSH & fleet automation