关于macOS的咖啡因实用程序的问题



当需要在macOS上运行长时间运行的计算时,caffeinate实用程序非常方便。

然而,从文档中还不太清楚,我想使用哪些标志?

man caffeinate说:

-i      Create an assertion to prevent the system from idle sleeping.
-s      Create an assertion to prevent the system from sleeping. This
             assertion is valid only when system is running on AC power.

我很难看出其中的区别。有人能解释一下吗?

-i标志使用PreventUserIdleSystemSleep断言状态,该状态可防止整个系统空闲休眠,这是未指定断言标志时的默认模式。

-s标志使用PreventSystemSleep断言状态,该状态仅在设备连接到交流电源时有效。

核心区别在于,使用-i标志,它可以防止用户空闲一段时间时激活的睡眠,但不会阻止系统在你(或其他东西(命令它睡眠时睡眠。另一方面,-s标志可以防止整个系统睡眠,即使它被指示这样做。

附言:您可以看到caffeinate使用pmset -g assertions | grep 'caffeinate'创建的断言类型。

最新更新