当需要在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'
创建的断言类型。