Skip to main content
POST
Server Power Action
Controls the power state of a server. This endpoint triggers power actions asynchronously and returns immediately.

Authentication

Requires the Wings authentication token in the Authorization header:

Path Parameters

string
required
The UUID of the server

Request Body

string
required
The power action to perform. Must be one of:
  • start - Start the server
  • stop - Stop the server gracefully
  • restart - Restart the server
  • kill - Forcefully terminate the server (SIGKILL)
integer
default:30
Number of seconds to wait for a lock on the power action (0-300). Defaults to 30 if not provided or out of range.

Response

Returns 202 Accepted when the power action has been queued for processing.

Error Responses

Cannot start or restart a suspended server.
The requested server does not exist on this Wings instance.
The power action provided was not valid.

Behavior

Power Action Locking

  • All actions except kill acquire an exclusive lock to prevent concurrent power actions
  • wait_seconds controls how long to wait for the lock (default: 30 seconds)
  • kill action attempts to acquire lock but proceeds even if it fails

Action Details

start
  • Only works if server state is offline
  • Runs pre-boot checks (sync, disk space, permissions)
  • Suspended servers are blocked
stop
  • Waits up to 10 minutes for graceful shutdown
  • Uses terminate signal if graceful shutdown fails
restart
  • Combines stop + start
  • Waits for complete shutdown before starting
  • Suspended servers are blocked
kill
  • Sends SIGKILL to immediately terminate the process
  • Does not wait for locks (bypasses lock contention)
  • Use for stuck or unresponsive servers

Pre-boot Process (start/restart)

  1. Syncs server configuration with Panel
  2. Checks suspension status
  3. Syncs environment variables and resource limits
  4. Verifies disk space availability
  5. Updates configuration files
  6. Sets file permissions (if enabled in config)

Example Requests

Start Server

Restart Server with Custom Wait Time

Kill Server

Example Response

Notes

  • Power actions run asynchronously in the background
  • Use websockets to monitor actual state changes
  • Errors during async execution are logged but not returned to the API caller
  • Multiple power actions are serialized via exclusive locking
  • The kill action bypasses most safety checks and should be used sparingly

Source Reference

Implemented in router/router_server.go:53 and server/power.go:56