Set a timer
Give a duration, from now:@ nickname like @daily, is read as a cron expression:
boxd takes the same command and defaults to the machine it runs on: boxd machine config set delete-after 2h, or --vm <name> for another of your machines.
Extend or clear it
Setting the timer again replaces it. That lets a script keep pushing its own deadline back while it is still working (see Leases below).See the time left
machine.delete_at (Python) / machine.deleteAt (TypeScript), None/null when there’s no timer, and the cron expression it was set with as delete_after_cron / deleteAfterCron. The console shows Deletes in … on the machine and in the machine list.
Forks
A fork starts with its own copy of its parent’s timer, counted from the moment of the fork: a parent set to delete after 2 hours gives every fork a fresh 2 hours, however long the parent has left. A cron timer carries over as the expression and fires at its next match after the fork. Pass--delete-after on the fork to give it a different timer, or --delete-after 0 for none. A machine restored from a snapshot starts without a timer.
Leases
For a job whose length you can’t predict, keep the timer short and have the job extend it while it is alive. If the job dies, or the machine stops responding, the extensions stop and the timer deletes the machine:If auto-suspend is on for the machine (it is off by default, but you may have set it, and a fork inherits its source’s), a job with no network traffic puts the machine into standby, which freezes the job and the loop with it. The timer still deletes the machine on time, but the job won’t finish. For batch jobs, pass
--auto-suspend-timeout 0 to be sure.