启动PLIST在启动时启动,但不应该这样做



就像它在锡上所说的那样,我的启动脚本应该在1.20 am发射,但似乎在用户登录后不久就发射了。谁能看到我做错了什么?

是我编写了programarguments的方式,在应用程序容器中启动它吗?我没有任何其他方式启动(AppleScript)应用程序的成功,即open ~/Library/CDesResources/Shutdown.app似乎没有用。

PLIST保存在~/Library/LaunchAgents/shutdownAgent.plist中,因此只有在用户登录正确的情况下才能发射?

非常感谢您的新鲜眼睛和专业知识。

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>shutdownAget</string>
        <key>Nice</key>
        <integer>-20</integer>
        <key>ProgramArguments</key>
        <array>
            <string>/Library/CDesResources/Shutdown.app/Contents/MacOS/applet</string>
        </array>
        <key>RunAtLoad</key>
        <false/>
        <key>ServiceDescription</key>
        <string>launch the shutdown script</string>
        <key>StartCalendarInterval</key>
        <dict>
            <key>Hour</key>
            <integer>1</integer>
            <key>Minute</key>
            <integer>20</integer>
        </dict>
    </dict>
    </plist>

来自 launchd.plist(5)的人页面:

与克朗(Cron)相比,在计算机睡觉时会跳过工作调用,下次计算机醒来时将启动该作业。如果多个 间隔在唤醒计算机之前就会爆发,这些事件将在睡眠中唤醒后将其合并为一个事件。

因此,launchd在发布时正确地注意到该作业在01:20没有运行并为您安排。

相关内容

最新更新