如何诊断我的 launchd 任务未按计划运行的原因?

Cam*_*rzt 8 scheduled-tasks launchd macos

我已经阅读了launchd.plist手册页,launchd 是否应该接收“错过的”事件?,而launchd 似乎忽略了 Yosemite 上的 StartCalendarInterval但这些都没有让我诊断为什么我的 launchd 任务没有运行。

我有一个任务计划在每天 10:35 运行,通常我的笔记本电脑当时处于睡眠状态,因此在这些情况下应该在笔记本电脑唤醒时启动该任务(并在笔记本电脑唤醒时正常运行)。

我实际看到的是,该任务很少单独运行,我始终必须使用 运行它launchctl start com.arewesmallyet.update,尽管当我这样做时它运行良好(一次)。

launchctl list | fgrep -i arewe 给出:

-   0   com.arewesmallyet.update
Run Code Online (Sandbox Code Playgroud)

的输出launchctl print gui/501/com.arewesmallyet.update是:

com.arewesmallyet.update = {
    active count = 0
    path = /Users/camdennarzt/Developer/Bash/dot-files/Library/LaunchAgents/com.arewesmallyet.update.plist
    state = waiting

    program = /Users/camdennarzt/Developer/Ruby/script.sh
    arguments = {
        /Users/camdennarzt/Developer/Ruby/script.sh
    }

    working directory = /Users/camdennarzt/Developer/Ruby/arewesmallyet

    stdout path = /Users/camdennarzt/Developer/Ruby/arewesmallyet/log/update.log
    stderr path = /Users/camdennarzt/Developer/Ruby/arewesmallyet/log/update_err.log
    global environment = {
        PATH => /usr/bin:/bin:/usr/sbin:/sbin
    }

    inherited environment = {
        DISPLAY => /private/tmp/com.apple.launchd.8iIoQIK3yn/org.macosforge.xquartz:0
        SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.YUM1kEhk5R/Listeners
        Apple_PubSub_Socket_Render => /private/tmp/com.apple.launchd.flahy7F91R/Render
    }

    environment = {
        XPC_SERVICE_NAME => com.arewesmallyet.update
    }

    domain = com.apple.xpc.launchd.user.501.100006.Aqua
    asid = 100006
    minimum runtime = 10
    exit timeout = 5
    runs = 3
    successive crashes = 0
    excessive crashing = 0
    last exit code = 0

    event triggers = {
        com.arewesmallyet.update.268435473 => {
            state = 0
            service = com.arewesmallyet.update
            stream = com.apple.launchd.calendarinterval.501
            monitor = com.apple.UserEventAgent-Aqua
            descriptor = {
                "Minute" => 35
                "Hour" => 10
            }
        }
    }

    endpoints = {
    }

    dynamic endpoints = {
    }

    pid-local endpoints = {
    }

    instance-specific endpoints = {
    }

    event channels = {
        "com.apple.launchd.calendarinterval" = {
            port = 0x4991b
            active = 0
            managed = 1
            reset = 0
            hide = 0
        }
    }

    sockets = {
    }

    spawn type = daemon

    properties = {
        partial import = 0
        launchd bundle = 0
        xpc bundle = 0
        keepalive = 0
        runatload = 0
        dirty at shutdown = 0
        low priority i/o = 0
        low priority background i/o = 0
        legacy timer behavior = 0
        exception handler = 0
        multiple instances = 0
        supports transactions = 0
        supports pressured exit = 0
        enter kdp before kill = 0
        wait for debugger = 0
        app = 0
        system app = 0
        creates session = 0
        inetd-compatible = 0
        inetd listener = 0
        abandon process group = 0
        one-shot = 0
        requires reap = 0
        event monitor = 0
        penalty box = 0
        pended non-demand spawn = 0
        role account = 0
        launch only once = 0
        system support = 0
        app-like = 0
        inferred program = 1
        joins gui session = 0
        joins host session = 0
        parameterized sandbox = 0
        resolve program = 0
        abandon coalition = 0
        extension = 0
        nano allocator = 0
        no initgroups = 0
        start on fs mount = 0
    }
}
Run Code Online (Sandbox Code Playgroud)