hangar restart
Restart a Hangar on a new machine, keeping its disk.
Starts a Hangar again on a new machine with the same disk. Everything running in its
terminal stops, agents included, and anyone connected is disconnected. Files under
/home/hangar stay where they were, and so do its ports and variables.
It starts with the variables, groups and ports saved for it, so a change made with
env set --hangar or
env group assign --hangar since it last started applies now.
It is back in under a minute: status reads deploying, then ready, with a window for
each agent again. The new machine pulls the Hangar image again, so a restart is how a
Hangar picks up a newer one. It is also the way out of a Hangar that froze at its memory
limit.
Usage
outplane hangar restart <HANGAR>Arguments
| Argument | Type | Description |
|---|---|---|
HANGAR | string | Hangar name or id. Required. |
Output
| Field | Type | Description |
|---|---|---|
restarted | bool | False for a dry run. |
hangar | string | The Hangar's immutable name. |
hangarId | string |
Examples
See what a restart would stop, without sending it
outplane hangar restart myhangar --dry-run --json{
"hangar": "myhangar",
"restarted": false
}Restart a Hangar
outplane hangar restart myhangarRestart one and read the result in a pipeline
outplane hangar restart myhangar --json --fields restarted,hangar{
"hangar": "myhangar",
"restarted": true
}Restart one in another team
outplane hangar restart myhangar --team acmeWhat to Know
- Everything running in the Hangar's terminal stops, agents included, and anyone connected is disconnected. Files under /home/hangar stay, on the same disk.
- It starts with the variables, variable groups and ports saved by then, so a change saved with
outplane env set --hangaroroutplane env group assign --hangarsince it last started takes effect. Its idle timeout is as it was. - The command returns once the restart is accepted, not once the Hangar is back. It is back in under a minute: poll
outplane hangar get <name> --json --fields statusuntil it has read deploying and then ready; a ready in the first few seconds can still be the state from before the restart.hangar connectis refused with hangar.not_running until then. - Exit 6 with hangar.not_running means nothing is running to restart, for example a Hangar that never started or one that is paused. Nothing changed, and retrying does not help. A paused one is started again with
outplane hangar resume, which the error names. - Not idempotent: each restart stops whatever is running at the time. Under --dry-run nothing is sent and restarted is false.
- It takes no confirmation, because the disk is the same one afterwards.
hangar deleteis the command that removes it.
Errors
Beyond 0 for success, this command exits with:
| Exit | Kind | Meaning |
|---|---|---|
2 | usage | Invalid arguments, unknown flag, or client-side validation failure. |
3 | auth | Not authenticated, token revoked or expired, or forbidden for this team. |
5 | not_found | The named resource does not exist, or is not visible to this credential. |
6 | conflict | The resource already exists, or a concurrent change won. |
8 | upstream | The Out Plane API returned a server error. |
The code on the error object is one of hangar.not_running, hangar.not_found, hangar.ambiguous, usage.missing_argument, usage.empty_argument, context.no_team. Branch on that, or on the exit status. The message is prose and changes.