Skip to main content
A synchronous command stops at its timeoutSeconds limit. The maximum is 600 seconds (10 minutes). For a longer job, start the command detached, then poll for its result. Examples are builds, installs and data processing. This replaces the nohup ... & pattern for simple cases. You do not keep an SSH session open. You do not write a unit file. The flow is: start, then poll, then collect.

Start a command and read its status

  • The command continues on the sandbox after the start call returns.
  • Boat appends stdout and stderr to ~/.ascii/processes/<pid>.log on the sandbox.
  • The status call gives running, the exitCode when the command ends, and the last part of each log.

Read only new output

  1. Give stdoutOffset and stderrOffset to the status call. Start at 0.
  2. The answer holds only the output written after those byte offsets.
  3. The answer also holds stdoutNextOffset and stderrNextOffset. Use them in the next call.
  4. When more is true, call again immediately.

Attach to a background process

Attach opens one stream. The stream sends the output while the command writes it, until the command ends. Use attach instead of polling. The API allows about 1,000 requests per minute per IP address. One poll per second for each of many processes reaches this limit. One open stream per process does not. Each line of the stream is one JSON object: After a reconnect line, open the stream again with those offsets. You get no gap and no repeat, for as long as the command runs. The CLI reconnects for you.
Polling and attach both read the sandbox live. Thus the sandbox must run.
  • A sandbox on an older agent answers 409 agent_outdated until its next agent upgrade.
  • To read output after the sandbox stops, use the command history.

Stop a background command

Stop the command by its process id. This also stops every process that the command started.
  1. Boat sends SIGTERM to the whole process group.
  2. After 5 seconds, Boat sends SIGKILL to the processes that remain.
  3. The response holds the history record of the command, with status killed and its last output.

When the agent restarts

The process runs under the systemd user manager of the sandbox user. Thus a restart of the agent of the sandbox does not interrupt it. A platform upgrade is an example of such a restart. But the agent forgets the process when it restarts:
  • The status changes to lost.
  • running becomes a best-effort check.
  • Boat no longer reports exitCode.
  • Boat reads the logs from the files on disk.
Detached processes do not continue after a stop, resume or fork. For a process that must come back by itself, run it as an always-on service.

Timeouts and retries

Synchronous commands accept timeoutSeconds from 1 to 600. The default is 30. Boat refuses values outside that range with a 400 invalid_timeout error. Boat never retries a command call automatically. A command is not idempotent. After a timeout (retryable: false) or a network failure during the call, the command can already run on the sandbox. You decide what to do next.