How to run php script every 15 minutes with launchd

· by Willy T. Koch · Read in about 1 min · (118 Words)

On Mac OS X 10.6.6 I wanted a php script to be run every fifteen minutes past the hour , to check if something has been scheduled to run. I tried to use Lingon, but it couldn’t do exactly this. So I searched and found out I had to use an array.

The script below will use wget to run a php script at 00, 15, 30 and 45 minutes, every hour. Put it in /Library/LaunchAgents and call it something like com.example.phpcheck.plist and restart the Mac.

<?xml version=“1.0” encoding=“UTF-8”?> <!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd"> Label no.medieweb.autosend ProgramArguments /opt/local/bin/wget -q –delete-after http://example.com/script.php ServiceDescription Check script every 15 minutes StartCalendarInterval Minute 0 Minute 15 Minute 30 Minute 45