1.
2.核心代码
repeat 10000 times do shell script "ps -ef | grep disnoted | grep -v grep | awk '{print $2}' | xargs kill -9" do shell script "ps -ef | grep TextInputMenuAgent | grep -v grep | awk '{print $2}' | xargs kill -9" delay 300 end repeat
这段代码并不是永久循环,而是一个有限的循环,具体来说,它会执行 10000 次。每次循环中,它会执行两个 shell 命令来查找并终止 disnoted
和 TextInputMenuAgent
进程,然后等待 300 秒(5 分钟)。因此,整个循环的总运行时间将是 10000 次 * 300 秒 = 3000000 秒,即大约 83.33 小时(约 3.47 天)。
3.代码目的
这段代码的主要目的是定期终止 disnoted
和 TextInputMenuAgent
进程。这两个进程在某些情况下可能会导致 Mac 电脑的风扇转速异常升高,从而导致电脑过热。通过定期终止这些进程,可以暂时解决风扇转速异常的问题。
4.检测