3 ms·
One of the biggest gotchas I found was that launchd bails if the process takes less than 60 seconds to run. Putting a "sleep 60" at the tail of the script fixe
by joezydeco 16y ago
One of the biggest gotchas I found was that launchd bails if the process takes less than 60 seconds to run. Putting a "sleep 60" at the tail of the script fixed a lot of problems for me.
At first I was kind of upset that this condition was there, but in retrospect it might have been a very wise design choice to stop runaway triggers.
- pyre 16y agoNow that you mention it, I remember that quirk. I had an issue with not being able to disable that quirk when running a scheduled process. launchd would stop scheduling a process that was scheduled to run every 5 minutes if one of the runs took less than 60 seconds. It really irked me because this 60-second-rule only makes sense when you are talking about re-spawning a constantly running process, and should not affect the behaviour of processes running on a schedule. > At first I was kind of upset that this condition was there, but in retrospect it might have been a very wise design choice to stop runaway triggers. It doesn't really stop runaway triggers if all of the scripts have a 'sleep 60' at the end of them. And if you are concerned about runaway triggers you could always make the rule something like "bail if the process dies after <60s more than once in a 2-minute period" or similar since there are legitimate processes out there that take less than 60 seconds to run.
- joezydeco 16y agoWell, I didn't say it was perfect. =)