Article · 3 min read · Home lab
kubespin: Sleep and keep awake
A laptop or desktop that goes to sleep goes offline: its apps stop, and kubespin can’t reach it. kubespin shows what makes a machine sleep, and keeps it awake with one switch you can undo.
A laptop or desktop that goes to sleep goes offline: its apps stop, and kubespin can’t reach it. kubespin shows what makes a machine sleep, and keeps it awake with one switch you can undo.
In kubespin
- Open the server and choose Manage. On laptops, desktops and boards, Power has a Sleep panel.
- The panel says in words what puts the machine to sleep, for example “Sleeps after 20 minutes idle on mains, and when the lid closes. While it sleeps its apps stop and kubespin can’t reach it.”
- Choose Keep awake. kubespin lists each change before you confirm:
- sleep, suspend and hibernate are turned off;
- closing the lid and the idle timer no longer put it to sleep;
- the desktop’s own idle sleep is turned off on mains. Tick On battery too to turn it off on battery as well.
- Confirm. The panel then reads, for example, “Kept awake by kubespin”.
The screen still blanks and locks as before. Only sleep is stopped.
Allow sleep again puts back exactly what was there before, including the desktop’s own settings. Both are written to the activity log.
What kubespin reads: systemd’s sleep targets, logind’s lid and idle settings, the desktop’s own idle sleep (GNOME and KDE) for the person at the desktop, and whether the machine is on battery.
At onboarding
When you add a laptop or desktop that would sleep, the last onboarding step shows the same line, with a Keep awake tick. It’s off unless you tick it.
Asleep, not offline
A machine that goes to sleep tells kubespin first. It shows as Asleep rather than Offline, and doesn’t raise a “server down” alarm.
On battery
While a laptop is kept awake and off mains, kubespin tells you when its battery falls below 15%, for example “debian-laptop is on battery at 12% and kept awake”. It never puts the machine to sleep itself.
Command line
The kubespin command has no sleep commands. Call the API with kubespin api, or from a script with an API token:
kubespin api GET /servers/$SERVER_ID/power
kubespin api POST /servers/$SERVER_ID/power/keep-awake '{"battery_too": false}'
kubespin api POST /servers/$SERVER_ID/power/allow-sleep
API
curl -s -X POST https://kubespin.io/api/v1/servers/$SERVER_ID/power/keep-awake \
-H "Authorization: Bearer $KUBESPIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"battery_too": false}'
GET /api/v1/servers/{id}/power returns what was read, kept_awake, and changes, the list of changes Keep awake would make. POST …/keep-awake and POST …/allow-sleep return the same, read again after the change. A server that doesn’t answer gives 504.
[!permissions] Permissions Area: Servers
Step Needs Default roles See the Sleep panel View Admin, Developer, Operator, Viewer Keep awake, or allow sleep again Manage Admin API token: Read only to look; Read and change for Keep awake and Allow sleep again.