axectl is the command-line client for AXE’s native API (axe.v1). axectl --help and axectl <command> --help print the same commands and flags.
axectl talks to axed’s gRPC port only. It does not use the Agent Sandbox REST port.
Global options
These work before or after the command name.axed’s gRPC endpoint. Environment:
AXE_ADDR.host:portfor TCP, for exampleaxed:9090. An address with a scheme, such ashttp://axed:9090, is used as given.unix:///pathfor a Unix socket.vsock://cid:portfor vsock. The cid must be a number.
Bearer token, sent as
authorization: Bearer <token> metadata on every call. Environment: AXE_TOKEN. Must be printable ASCII. --help does not print its value.Process names and ids
Commands that takePROCESS accept an id or a name.
- A string of exactly 32 hex digits is an id, as printed by
runandps. - Anything else is a name. A name refers to the running process with that name, or after it exits, the most recently finished process with that name that axed still remembers.
run --name with a name in use fails until the first process exits.
Exit codes
axectl clamps exit codes outside 0 to 255 to that range. 125, 130 and 143 are ambiguous. A process can exit with any of them itself, 130 also means a process killed by SIGINT, and 143 a process killed by SIGTERM.
Process options
run and exec take these options before the command. Everything after the first argument that is not an option, or after --, is the command and its arguments.
Run on a pseudo-terminal sized to the local terminal, or 80x24 when there is none. Output from a terminal is all stdout.
Kill the process tree after this much running time. Time the sandbox spends suspended does not count. Uses Go duration syntax, as axed’s flags do: for example
30s, 5m, 1h30m, 1.5h.Memory ceiling: a number of bytes, or a whole number with a binary unit (
KiB, MiB, GiB; K, M, G mean the same), for example 512MiB. With cgroups this limits the whole tree; without, it is RLIMIT_AS per process.CPU limit as a number of CPUs, for example
0.5 or 2. The smallest value is 0.001. axectl sends it to axed in millicores (cpu_millis, 1000 for one CPU). Requires cgroups; without them the start fails.Commands
run
Start a detached process that keeps running whenaxectl exits. Prints the process id.
Attach right away instead of printing the id, with stdin forwarded. With
-t, Ctrl-P Ctrl-Q detaches and leaves the process running. Implies -i.Keep the process’s stdin open, so a later
attach -i can write to it. Without -i or -a, stdin is /dev/null unless -t is set; a terminal always has input.Output to retain for replay, in bytes or with a binary unit, as for
--memory. 0 uses the daemon’s --retain. More than the daemon’s --max-retain fails.Idempotency key. Running the same command again with the same key prints the first process’s id instead of starting another, so a script can retry safely. The same key with a different command or options fails with
already exists (REQUEST_ID_CONFLICT).Processes.Start, then Processes.Attach with -a.
exec
Run a process attached to this terminal and exit with its exit code. axed kills the process ifaxectl disconnects or exits. axectl forwards stdin, and local end-of-file ends the process’s input. For a pipe, that closes the process’s stdin. On a terminal, axed sends the terminal’s end-of-file character (Ctrl-D), so input piped to exec -t ends as well. A program that switches the terminal to raw mode, such as bash or python3 with readline, can miss that Ctrl-D when it arrives before the program reads, and then keeps waiting; end such input with an explicit command such as exit. Ctrl-P Ctrl-Q does not detach.
With -t and a local terminal, axectl switches to raw mode. Keys, Ctrl-C included, go to the process, and axectl forwards window size changes. Without raw mode, Ctrl-C makes axectl exit with 130, which kills the process.
Processes.Run without detach.
attach
Replay a process’s retained output, then follow it until it exits. Exits with the process’s exit code. Without-i, axectl does not read stdin, so Ctrl-P Ctrl-Q does not detach. Ctrl-C stops following, axectl exits with 130, and the process keeps running.
Replay from this output byte offset instead of the oldest retained byte. An offset past the end starts at the end.
Never slow the process down.
axectl skips output evicted before it reads it and reports it on stderr as axectl: N bytes of output were dropped. By default a slow reader holds the process back.Forward stdin. On a terminal process, Ctrl-P Ctrl-Q detaches. On a terminal process with a local terminal,
axectl switches to raw mode. Keys, Ctrl-C included, go to the remote process, and axectl forwards window size changes. Otherwise Ctrl-C stops following and axectl exits with 130; the process keeps running.logs
Print a process’s retained output and exit with0. Stdout and stderr go to the matching local streams.
Start at this byte offset of the output instead of the oldest retained byte. The
OUTPUT column of ps shows how many bytes a process has written.logs reads lossily. It never slows the process and reports skipped bytes on stderr.
ps
List processes, running and finished, in start order.CPU and MEM cover the whole tree when axed runs the process in a cgroup. Without one they cover only the leader and end in *, as in 0.3*. axed reads them when ps asks; nothing samples in the background.
kill
Send a signal to the process’s process group.A signal number, or one of
HUP, INT, QUIT, KILL, USR1, USR2, TERM, STOP, CONT, WINCH. Names are case-insensitive and may start with SIG. Other signals work by number.wait
Wait for a process to exit, print why it ended and its exit code, and exit with its exit code.STATE words of ps, for example timed-out 137 or exited 0.
rm
Forget a finished process, freeing its retained output.Kill a running process tree first, wait for it, then forget it. Without
-f, a running process fails with failed precondition.watch
Print file changes under a directory of the sandbox root, one per line, until interrupted.CREATE, WRITE, REMOVE, RENAME, CHMOD) and the path relative to the root. A rename prints RENAME with the old path, then CREATE with the new path when it lands inside the watched tree.
Errors go to stderr, prefixed with axectl: watch:. An error that leaves the watch running, such as a kernel queue overflow, is reported and watching continues. An error that ends the watch makes axectl exit with 1.
freeze
Freeze every running process tree through its cgroup, as a quiesce point before a snapshot. Requires cgroups. PrintsN of M process trees frozen. Waits up to 5 seconds for the trees to change state. Until the thaw, starting a process fails with failed precondition (FROZEN).
resumed
After restoring a snapshot, send axed this machine’s wall time and 64 bytes of fresh entropy, and record a resume. Prints the new generation, how far the clock was stepped, and whether the entropy was added. Run it from the host side, where the clock is right.Also thaw processes frozen with
axectl freeze, after the clock is set and the resume recorded. Adds N process trees thawed to the output. Does nothing without cgroups.CAP_SYS_TIME), then adds the entropy (needs CAP_SYS_ADMIN), then records the resume. Without CAP_SYS_TIME the command fails when the clock is off, and no resume is recorded. The entropy is best effort: without CAP_SYS_ADMIN it is skipped and the output says entropy not added.
Uses System.Configure with resumed: true. See Snapshots.
info
Print daemon state and capabilities.Detaching
run -a and attach -i detach on Ctrl-P followed by Ctrl-Q, and exit with 0. The process keeps running. Ctrl-P followed by any other key sends both keys. Detaching applies only when the process has a terminal (-t). On a process without one, axectl forwards every input byte unchanged, so binary input passes through intact. Docker also claims Ctrl-P Ctrl-Q, so when you run axectl with docker run -it, pass --detach-keys to give Docker another sequence.

