flow_AutoShutdown
Shut your PC down when a batch finishes
Exactly what it says: when a task counter you're feeding it hits a target number, it shuts down or sleeps your machine. It's built for the overnight-batch scenario - you queue up a hundred generations before bed, and instead of your PC idling at full draw until you wake up, it powers itself down the moment the last one lands.
How it works
You wire something that increments as your batch progresses into current_task_count - the pack's own loop nodes (flow_forStart/flow_forEnd) are the natural source, since their index output climbs on every iteration. Set target_task_count to how many you're running. Once current_task_count reaches that target, the node waits action_delay_minutes (a grace period, presumably so you can cancel if you're still watching) and then fires action_type: None does nothing, 关机 shuts the machine down, 睡眠 puts it to sleep. It has no outputs at all - this is a pure side-effect node, meant to sit at the end of a graph and do one thing.
Inputs
- current_task_count (INT, default 0) - feed your running counter here.
- target_task_count (INT, default 10, minimum 1) - how many completed tasks trigger the action.
- action_delay_minutes (FLOAT, default 5) - how long to wait after the target is hit before acting.
- action_type (enum: None / Shutdown / Sleep) - what actually happens. Defaults to None, so nothing dangerous fires until you deliberately change it.
There's no output - it's an action node, not a data node.
Installing it
Search ComfyUI-Apt_Preset in ComfyUI Manager and install, or manually: cd ComfyUI/custom_nodes && git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git, then restart. The README's dependency step is "double-click install.bat," which tells you this is a Windows-first pack - there's no requirements.txt documented, so Linux/Mac users should open that file to see what it's installing and do it manually in their ComfyUI venv. This node doesn't need any of the pack's optional extras (GGUF, Advanced-ControlNet, nunchaku, downloaded models) - it's pure Python control flow.
Common issues
The obvious one: it really does shut down or sleep your computer. Default action_type is None, which is a sane guardrail, but once you set it to shutdown or sleep for a real overnight run, remember to reset it back to None before you go back to interactive testing - nothing is more annoying than your dev machine sleeping mid-session because a leftover test wire pushed current_task_count past target_task_count.
The README doesn't document how the underlying shutdown/sleep commands behave across operating systems - given the pack's Windows-leaning install process, it's a reasonable bet the shutdown action calls a Windows-specific command under the hood. If you're on Linux or Mac and the action doesn't fire, that's the first thing to check rather than assuming your wiring is wrong.
And the general pack caveat: this is one node inside a large, single-package pack, and import failures elsewhere in the pack can take this node down too. If it's not showing up after install, check the ComfyUI console log at boot for the real error before troubleshooting your workflow.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| current_task_count | INT | 0 | — |
| target_task_count | INT | 10 | — |
| action_delay_minutes | FLOAT | 5.0 | — |
| action_type | COMBO | None | 3 options: None, 关机, 睡眠 |
Outputs (0)
No outputs