macostimeoutlaunchdlaunchdagent

launchd ExitTimeOut doesn't work


I Have a plist file with some job:

<dict>
    <key>Label</key>
    <string>StartScript</string>
    <key>Program</key>
        <string>/Users/ie54553/Desktop/script.sh</string>

    <key>StartInterval</key>
        <integer>10</integer>

    <key>ExitTimeOut</key>
        <integer>30</integer>

    <key>StandardOutPath</key>
        <string>/tmp/Out.log</string>
    <key>StandardErrorPath</key>
        <string>/tmp/Err.log</string>
</dict>

The problem is that the script.sh is being executed each 10 sec over and over, and doesn't stop the execution after the ExitTimeOut time (30 sec)

From some reason the ExitTimeOut doesnt work ...

Any idea how I can kill the job / execution ?

Tanks


Solution

  • This is not what ExitTimeOut is for. When unloading a job launchd sends the signal SIGTERM to the process. Should the job not terminate within ExitTimeOut seconds (20 seconds by default), launchd will send signal SIGKILL to force-quit it.

    launchd has no means to terminate a job after a given timeout.