CLI reference
Every forkspan command with its options, its exit codes and its settings.
The forkspan executable installs, registers and runs the sandbox service on a sandbox server.
Before installation, run it from the directory that holds it, as ./forkspan. The installer
then creates the forkspan command link.
On Linux, run each command as root. On macOS, run it as your user:
sudo forkspan statusCommands
| Command | Effect |
|---|---|
forkspan --version | Print the version, such as forkspan-cli 0.1.0 (engine opensandbox-server 1.1.1). |
forkspan install | Install the service and register the machine. See Install options. |
forkspan register | Register an installed machine with a token from --token-stdin. Add --reregister to replace a registration. |
forkspan start | Start the service. |
forkspan stop | Stop the service now. Running work stops too. |
forkspan drain | Stop taking new work. Add --wait to wait for current work to finish. |
forkspan resume | Take new work again after a drain. |
forkspan restart | Drain, restart the service and wait until it is ready. |
forkspan status | Show the installation, the service, the registration, the engine, the connection and the maintenance state. Add --check to exit 0 only when the machine can accept work. |
forkspan doctor | Check the host and the installation. See Doctor options. |
forkspan logs | Print the last 200 lines of service logs. Add --follow to stream them. |
forkspan diagnostics | Write one private archive for a support request to the path in --output <path>. Nothing is uploaded. |
forkspan config show | List the saved settings. |
forkspan config set <key> <value> | Save one setting. See Settings. |
forkspan uninstall | Remove the service, the installation and the command link. Add --purge-data to remove the state too. |
Install options
forkspan install takes these options. forkspan register takes --token-stdin, --ownership
and --reregister.
| Option | Effect |
|---|---|
--noninteractive | Never prompt. Requires --base-url. |
--base-url <url> | The address of the Forkspan web app. |
--token-stdin | Read the registration token from standard input. |
--prefix <dir> | The installation directory. |
--name <name> | The machine name. The default is the host name. |
--ownership workspace | Required for a token created for a workspace-owned machine. The default is personal. |
--cpu-millicores <n> | CPU that Forkspan work can use, in millicores. The default is all cores. |
--memory-bytes <n> | Memory that Forkspan work can use. The default is all memory. |
--disk-bytes <n> | Disk that Forkspan work can use. The default is the free space in the state directory. |
--bin-dir <dir> | Where to create the forkspan command link. The default is /usr/local/bin. |
--reregister | Replace an existing registration with the new token. |
Doctor options
| Option | Effect |
|---|---|
--offline | Skip the network checks. |
--smoke | Run one small, fixed sandbox through the bundled engine. |
--json | Write one JSON document to stdout. Progress goes to stderr. |
forkspan doctor explains each check and option.
Settings
forkspan config show lists the saved settings. forkspan config set <key> <value> saves one
change, which the service loads at its next start.
| Key | Value |
|---|---|
name | The machine name. |
base-url | The address of the Forkspan web app. |
docker-context | The Docker context the service uses. |
docker-host | The Docker endpoint the service uses. |
cpu-millicores | CPU that Forkspan work can use. |
memory-bytes | Memory that Forkspan work can use. |
disk-bytes | Disk that Forkspan work can use. |
A capacity value above what the machine has is refused.
The machine takes one run per CPU core at most, within its CPU, memory and disk. To run fewer at once, set Simultaneous attempts on the machine's Capacity tab in the app.
You cannot move a registered machine to another Forkspan address with config set base-url. The
stored credential belongs to the original address. Register the machine again instead.
Exit codes
Every forkspan command uses the same exit codes.
| Code | Meaning |
|---|---|
0 | Success. |
2 | Usage error: a missing or unknown option. |
3 | Refused: a requirement or an authorization is missing. |
4 | The operation failed. |
Some commands give these codes a narrower meaning:
forkspan doctorexits0when every required check passed. Warnings do not change the exit code. It exits3when a required check failed or was not checked.forkspan doctor --offlineon an installed machine always exits3. The API check is required there, and the option skips it.forkspan statusexits0whenever it can inspect the machine.status --checkexits0only when the machine can accept work, and3otherwise.- On Linux,
forkspan installwithoutsudoexits4when it cannot create the service account or write system directories.