Skip to main content

Shutdown

Schedule a shutdown on the target host. The agent calls shutdown -h with the configured delay. When --delay is 0, the shutdown happens immediately:

$ osapi client node power shutdown --target web-01

Job ID: 550e8400-e29b-41d4-a716-446655440000

HOSTNAME STATUS CHANGED ACTION DELAY
web-01 changed true shutdown 0

1 host: 1 changed

Shutdown with a 60-second delay and a broadcast message:

$ osapi client node power shutdown --target web-01 \
--delay 60 --message "Scheduled maintenance shutdown"

Job ID: 550e8400-e29b-41d4-a716-446655440000

HOSTNAME STATUS CHANGED ACTION DELAY
web-01 changed true shutdown 60

1 host: 1 changed

Broadcast shutdown to all hosts at once:

$ osapi client node power shutdown --target _all --delay 30

Job ID: 550e8400-e29b-41d4-a716-446655440000

HOSTNAME STATUS CHANGED ACTION DELAY
web-01 changed true shutdown 30
mac-01 skip

2 hosts: 1 changed, 1 skipped

Details:
mac-01 unsupported platform

JSON Output

Use --json to get the full API response:

$ osapi client node power shutdown --target web-01 --json
{"results":[{"hostname":"web-01","action":"shutdown","delay":0,"changed":true,"status":"ok"}],"job_id":"..."}

Flags

FlagDescriptionDefault
--delaySeconds to wait before shutting down0
--messageOptional message to broadcast before shutdown
-T, --targetTarget: _any, _all, hostname, or label (group:web)_all
-j, --jsonOutput raw JSON response