The expensive mistake on any cloud is forgetting a machine, even one you picked correctly. You finish at seven, you close the lid, and something in a data centre keeps billing you until you remember on Thursday.
Sixty idle minutes and our workspaces switch themselves off. The hard part is deciding what counts as idle.
The naive version is dangerous
The obvious implementation watches for keyboard and mouse input and shuts down when it has not seen any for an hour. It is about twenty lines, and it will eventually destroy somebody’s afternoon.
Consider what it does to a long compile. You start a build that will take ninety minutes, you go and have lunch like a reasonable person, and the machine notices sixty minutes of no typing and kills a job that was two-thirds done. The feature that was supposed to protect you from your own forgetfulness has instead punished you for walking away from work that was still happening.
A user who gets burned by that once does not trust the feature
again. They leave a terminal running
while true; do echo .; sleep 60; done
in the corner, which defeats the entire purpose, and now they
are paying for overnight machines and they are
annoyed with us.
Three conditions
So the check is conservative on purpose. A workspace is a candidate for shutdown only when all three of these are true at once, continuously, for the full sixty minutes. Any one of them resets the clock:
No input. No keyboard, no mouse, no controller. A cursor moved once in the fifty-ninth minute resets the hour.
No session attached. No Moonlight client is connected. A connected session with no input is not idle, because you may be reading.
No meaningful CPU. The five-minute load
average is near zero. This is the one that answers the compile
above: a build, a download or any long job keeps the machine
alive on its own, without you leaving a terminal running
sleep in a loop to prove you
still exist.
The rule leans one way on purpose. The two ways to be wrong are not equally bad: shutting down a machine somebody was using costs them work, and leaving a machine up for an extra hour costs them a few rupees. We would rather make the second mistake every time, and the rates are low enough that the arithmetic supports the preference.
What it will not save you from
It will not stop a job you meant to leave running. If you kick off something that churns CPU all night, the machine is working, the machine is not idle, and you are charged for the night. That is the intended behaviour, and we want you to know it before you see the bill: the shutdown protects you from forgetting an empty desktop, not from deliberately starting long work and walking away.
It also is not a replacement for stopping a workspace yourself. An hour is an hour. If you know you are done, end the session and stop paying for the hour of grace.
Why this is a default and not a setting
We could expose the interval. We have not, because a protection you have to opt into is one most people will not have switched on at the moment they need it, and the population who would raise the limit overlaps almost perfectly with the population who would then forget a machine at the higher limit.
If sixty minutes does not fit your case (a teaching lab that runs on a timetable, say, or a batch job with a predictable shape), tell us about it. That is a better way to find the right second behaviour than guessing at one now.