← All posts

Run Your Python Scraper for 12 Hours Without Your Laptop Awake

September 9, 2026 · 4 min read · The xShellz Team

TL;DR

  • An xshellz.box Agent Shell runs 24/7 with no idle timeout, so your long-running Python scraper keeps going even when you disconnect.
  • Use tmux inside the box to start a session, detach, and reattach later from any machine: the script never dies.
  • The /root home directory persists across restarts, so your code, logs, and installed packages are always there.

To run a long script without losing it when you close your laptop, offload to an always-on remote Linux box with tmux. An xshellz.box Agent Shell is a persistent Ubuntu 24.04 machine that never sleeps. We run these boxes for our own builds; this is the production setup.

How can I run a long-running script or scraper on a remote server without it dying when I close my laptop?

Launch your script inside a tmux session on an always-on remote box. The remote box keeps running 24/7, so closing your laptop or losing WiFi has no effect. When you reconnect, reattach to see the script's output. For a persistent, no-idle-timeout box, an xshellz.box Agent Shell runs Ubuntu 24.04 LTS with tmux preinstalled and never suspends, even on the free tier. You log in as root via SSH, start tmux, run your script, detach, and walk away. There is no trial countdown and no automated shutdown; the box is designed for always-active agents.

how to run a long process on a remote linux box and keep it alive

SSH into your box, then wrap the process in a tmux session. The session stays alive independently of your login. Detach with the standard keybinding, and the job runs on. Reattach later to check its progress or collect output.

ssh -p <port> root@<host>
tmux new -s scrape
# inside tmux:
python3 long_scraper.py
# press Ctrl-B D to detach
# later, from any terminal:
ssh -p <port> root@<host>
tmux attach -t scrape

The preinstalled Python 3 and build-essential packages mean you can launch heavy crawls immediately. Use pip to add dependencies; for repeatable setups, list them in your xshellz.box manifest so they are reinstalled every boot, right into the persistent /root home.

how to use tmux to manage remote terminal jobs

tmux is a terminal multiplexer that creates persistent sessions. A session can hold multiple windows, each running its own shell. The basic commands:

tmux new -s myjob         # start a new session
tmux ls                   # list all sessions
tmux attach -t myjob      # attach to a session
tmux kill-session -t myjob  # stop a session completely

Inside tmux, Ctrl-B C opens a new window and Ctrl-B N cycles to the next. This lets you run a scraper in one window while monitoring logs or editing code in another. Because every xshellz.box comes with tmux preinstalled, you can start managing jobs the moment you log in.

can I run heavy python scrapers on a cloud shell instead of my laptop?

Yes, a remote always-on box frees your local CPU, RAM, and battery. The box's resources are consistent, and you never compete with your own desktop work. You can pre-install Python packages with a one-line manifest. For example, add pip: requests lxml beautifulsoup4 to your xshellz.box manifest, and those packages will be ready on every boot. The box never goes to sleep, so a scraper that takes hours can finish unattended. On the pricing page you can select a tier that matches your workload's memory and CPU needs.

what is the difference between an ephemeral sandbox and an always-on box for long jobs?

Ephemeral sandboxes are designed for one-off, short-lived tasks; when you stop the job, the sandbox is destroyed and any running process is killed. An always-on box like the Agent Shell remains running across connections, and its /root directory persists through image updates. For scrapers, training runs, or any process that may run for days, only the always-on box guarantees the process won't be terminated unexpectedly. The always-on box is your persistent home on the internet; the sandbox is a disposable workspace.

Frequently asked questions

Do I need to keep my laptop on or the SSH connection open?

No. Once you detach a tmux session with Ctrl-B D, the scraper runs on the remote box independently. You can close your laptop, lose WiFi, or switch computers. Later, ssh back in and tmux attach to see the results.

Can I run multiple scrapers or heavy jobs at the same time?

Yes. Create separate tmux sessions (tmux new -s job1, tmux new -s job2) or use multiple windows within one session. All processes share the box's CPU and RAM. If you need more horsepower, upgrade the plan.

What if the box is rebooted unexpectedly? Will my jobs survive?

The box is always-on, but a reboot clears running processes. Your scripts and logs in /root survive. To auto-restart a critical job, wrap it in a while true loop inside tmux or create a systemd service. For the most sensitive workflows, monitor with external health checks.