Oko/Docs

Command reference

oko sessions end

Ends one session by its id, or every session a selector admits, instead of by a list somebody wrote down.

Invocation#

Command
oko sessions end [ID] [--dead] [--older-than SECONDS] [--all] [--dry-run] [--socket PATH] [--json]

Inputs and options#

  • ID ends that one session. --dead selects the sessions whose process no longer exists and is the default when neither an ID nor a selector is given; --older-than SECONDS selects the sessions the broker started before that age; --all selects every session, live ones included. The selectors compose: a session is selected when any of them admits it.
  • --dry-run ends nothing; --json prints the decision as an object. `oko sessions end --help` prints the flags.

Output and state effect#

  • Reads the broker's own session list, asks the kernel whether each session's process still exists (getpgid(pid), which changes nothing; a pid of 0 or below names a process group, never one process, and is never alive), and ends each selected session: its process group gets SIGTERM and its terminal is closed. Prints the socket, how many sessions the broker holds, how many were selected, and one line per selected session with its id, pid, whether the process is alive and its executable; --json adds sessions, selected, ended, failed and dry_run.

Refusals and safe exits#

  • An ID together with a selector refuses with “oko sessions end takes one session ID or the selectors --dead, --older-than and --all, not both”, and an --older-than that is not a number of seconds with “--older-than takes a number of seconds, not <value>”, both before the broker is contacted (exit 2). An ID the broker does not hold refuses with “the broker at <socket> holds no session <id>; it holds: <ids>”. A broker row missing a field, or whose process is not one positive process id, is refused naming the row, as `oko sessions list` refuses it. A session the broker refuses to end is reported per session and the command exits unsuccessfully.

CLI reference#