Continue the Route Build in Another Terminal

LinuxBeginner
Practice Now

Introduction

A community trail desk is preparing route cards for visitors. The supplied mapper calculates paths through a small synthetic network and draws real SVG maps. It builds one batch, then waits for your next batch and route mode. The next group needs routes without stairs, so simply leaving the first command in the background is insufficient: you must return to its input prompt.

You will start a named tmux session in Terminal A, detach, continue the same process from Terminal B, and use the resulting collection in Maps. Basic terminal familiarity is enough; you do not write Python or need mapping experience. All routes are synthetic training data, not directions for a real trail.

Start a Named Mapping Task

In this step, you will start a genuine interactive mapping task and leave it waiting for the next batch.

A shell reads commands. A task is a program the shell starts. tmux keeps a terminal and its task alive in a background server. A named session groups windows, each containing a terminal. A client connects your browser terminal to that session. Detaching removes the client, while the server and task continue. tmux does not recover work after the VM or server is destroyed.

Both browser terminals start in /home/labex/project/trail-maps, already inside separate platform tmux sessions. plan.tsv is a relative path: it names the file in that current directory. Avoid creating another attached tmux inside them. First read the plan in Terminal A. cat prints a file; the columns specify the job, next batch, route mode and reason.

cat plan.tsv

The survey job needs the east batch in step-free mode. walking may use stairs; step-free excludes stair edges before calculating the shortest route. The first batch uses walking, so its shorter route can legitimately differ. No geographic knowledge is required.

List sessions. list-sessions is a tmux command; keep the prepared trail-reference session intact. Names beginning with TTYD- belong to the platform.

tmux list-sessions

Create trail-survey. new-session creates a session, -d leaves it detached, and -s gives its unique name. The quoted final argument is the command to run in its terminal. python3 runs the supplied program; guided selects this lab's independent job. This starts the mapper directly inside the session.

tmux new-session -d -s trail-survey 'python3 /opt/labex/atlas/map-job.py guided'

Connect to it. attach-session with -t selects a target. Inside the platform's existing tmux client, this changes the client's session rather than nesting another tmux.

tmux attach-session -t trail-survey

The absolute program path identifies the prepared mapper. It reports a PID, writes two morning SVG files, and stops at Next batch:. Keep that PID in view: Terminal B must show the same one. The program is still alive and waiting for input; the missing shell prompt is expected. Do not type a shell command into this question.

If creating the session says duplicate session, list sessions and attach the existing trail-survey; do not delete its files or start a replacement. If you see sessions should be nested with care, you attempted an attached new-session inside tmux: return to the platform shell and use the detached creation above. Verify this step while the mapper still waits.

Continue from Terminal B

In this step, you will detach the first client and complete the next batch through a second independent terminal.

Focus Terminal A. Hold Ctrl and press B, release both, then press D. This is a prefix followed by a key, not three keys held together. It sends tmux's detach command. Do not use exit or Ctrl+C: those terminate a shell or interrupt the mapper instead of disconnecting its display.

The browser shows [detached (from session trail-survey)]. Because the platform starts tmux directly, this browser terminal has no outer shell to return to. Leave it there. Open Terminal B, which has its own persistent shell. Closing a browser tab or losing a network connection is a different event; this exercise deliberately tests detach and reconnect on the same VM.

List sessions in Terminal B:

tmux list-sessions

trail-survey should remain listed, now without an attached client. Reconnect to that exact name:

tmux attach-session -t trail-survey

You should see the same PID and Next batch: question as before. If you still see a shell prompt, you have not connected to the mapper. If you see another job, detach and select the right name; do not send answers to it.

Enter the requested next batch at the program prompt. This is input to the mapper, not a shell command:

east

It now asks Route mode:. Supply the accessibility mode from the plan:

step-free

Before generating files, it displays Plan: east / step-free and asks Build this batch? [yes/no]:. Read the batch and mode together. If either is wrong, enter no to return to Next batch: in the same process; the original maps remain untouched. After selecting the correct plan, confirm:

yes

The program calculates two more routes, writes their SVGs, and updates the collection index. Expect Collection ready: 4 real SVG maps and index.json. The final Inspection mode prompt deliberately keeps the original process available for inspection. Leave it alive. Invalid batch names or modes are rejected without losing the first batch, so read the prompt and retry the same question. A valid but wrong choice can be corrected at the confirmation prompt: enter no and choose again. Refreshing the browser does not change a pending plan. Once you confirm yes, this collection is final; compare with the plan before committing. Do not delete files or restart a process to disguise a new task.

The checker compares the live process, exact routes and complete index. Creating a fresh process with similar output does not represent continuing this task.

Use the Completed Map Collection

In this step, you will inspect the actual maps and their machine-readable index while keeping the tasks available.

Open Maps and select the survey/ directory. The first two cards are the original morning maps. The next two are east maps in step-free mode. Open Download SVG on the east route to Cabin and save the SVG. The green route should go through Orchard, avoiding Bridge's stair edges. The first morning route to Cabin may use Bridge. These differences come from graph calculations using the selected mode, not from changing a label.

Return to the collection and read the east Lookout route. Its route and duration are also recorded in index.json. To inspect that data, stay in Terminal B and press Ctrl+B, then C. This creates a new tmux window containing a shell while the mapper keeps running in window 0. A window is another terminal within the same named session; it does not restart the program. The shell prompt means you can enter commands again.

Use cd to set the shell's current directory explicitly. The absolute path starts at /, so it works regardless of where the new shell began:

cd /home/labex/project/trail-maps

ls lists names in a directory. Confirm all four maps, the HTML viewer, index and process information are present:

ls survey

Print the index using its relative path:

cat survey/index.json

Every record includes a batch, mode, destination, minutes and the calculated node sequence. The original maps remain alongside the new maps. This is a usable collection, not just a completion message.

List sessions again:

tmux list-sessions

Both trail-survey and trail-reference must remain. A session can be detached and still running. The platform's TTYD- sessions are unrelated to the business tasks. Do not run kill-server to tidy up: it would terminate every session, including the reference. Keep the environment running until checks pass. To return to the original mapper, press Ctrl+B, then the digit 0. This selects window 0; the inspection prompt and same PID should still be present.

You have functionally continued one process between two browser terminals. This does not demonstrate recovery after a VM reboot, physical machine changes, automatic task retries or platform network reconnect behavior.

Summary

You created a named tmux session, detached one client, and reattached from another terminal to answer the same live mapper. The collection contains the original walking maps plus the requested accessible maps and their exact index. You also preserved the reference session. Session continuity depends on the tmux server and VM remaining alive.