0

TL;DR: I have a LaunchAgent that is triggered with WatchPaths that runs a very simple/quick script and exits cleanly. But it ends up generating console log such as this:

Apr 25 19:30:45 my-clever-hostname com.apple.xpc.launchd[1] (com.mytld.btautopair): Service only ran for 5 seconds. Pushing respawn out by 5 seconds.

What is this "respawn" business? What does it mean that it is pushing respawn out by 5 seconds? Is this just a log message I can safely ignore? Is there a way to silence it?

The thing is, everything is working as expected. The script is short and sweet.

Details:

The launch agent plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>

    <key>Label</key>
    <string>com.mytld.btautopair</string>

    <key>ProgramArguments</key>
    <array>
        <string>/Users/myusername/Library/Scripts/bt_autopair.bash</string>
    </array>

    <key>WatchPaths</key>
    <array>
        <string>/Library/Preferences/com.apple.Bluetooth.plist</string>
    </array>

</dict>
</plist>

And the bash script it triggers:

#!/bin/bash

# Keychron K1 keyboard id: dc-dc-22-55-12-8c
# Magic Mouse "magictron": 78-ca-ca-ed-ed-27
if [[ $(/usr/local/bin/blueutil --is-connected dc-dc-22-55-12-8c) = 1 ]]; then
    if [[ $(/usr/local/bin/blueutil --is-connected 78-ca-ca-ed-ed-27) = 0 ]];then
        /usr/local/bin/blueutil --connect 78-ca-ca-ed-ed-27
    fi
else
    if [[ $(/usr/local/bin/blueutil --is-connected 78-ca-ca-ed-ed-27) = 1 ]];then
        /usr/local/bin/blueutil --disconnect 78-ca-ca-ed-ed-27
    fi
fi

exit 0

Is there more I could add to my launch agent plist that would let launchd know that I don't expect my agent/daemon to run long at all?

You must log in to answer this question.

Browse other questions tagged .