Out Plane
hangar

hangar restart

Restart a Hangar on a new machine, keeping its disk.

writes--dry-run

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

ArgumentTypeDescription
HANGARstringHangar name or id. Required.

Output

FieldTypeDescription
restartedboolFalse for a dry run.
hangarstringThe Hangar's immutable name.
hangarIdstring

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 myhangar

Restart 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 acme

What 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 --hangar or outplane env group assign --hangar since 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 status until it has read deploying and then ready; a ready in the first few seconds can still be the state from before the restart. hangar connect is 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 delete is the command that removes it.

Errors

Beyond 0 for success, this command exits with:

ExitKindMeaning
2usageInvalid arguments, unknown flag, or client-side validation failure.
3authNot authenticated, token revoked or expired, or forbidden for this team.
5not_foundThe named resource does not exist, or is not visible to this credential.
6conflictThe resource already exists, or a concurrent change won.
8upstreamThe 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.

On this page