[launchd-dev] Restrict so only one instance runs

Crawford Kyle kcrwfrd at gmail.com
Wed Aug 27 11:28:27 PDT 2008


Hello,

I often need to schedule scripts to run at an interval, but I don't  
know how long that script will take to complete and I don't want the  
script to run again at its normal interval unless the script isn't  
running.

I've done this with pid files and grepping through ps lists to exit  
the script if another instance is running, but I was wondering if  
there is something built into launchd to handle this.

I tried combining LaunchOnlyOnce with StartInterval, but with  
LaunchOnlyOnce, it seems that the job gets unloaded as soon as it  
runs, so the interval becomes pretty meaningless.

Is there a way to do this with launchd?  Should there be a way to do  
this with launchd?

Thanks,

Kyle



More information about the launchd-dev mailing list