I'm running a very small (basically a test) newsletter from my os x server system... CRON is deprecated in os x server, should I use launchd or still try to use CRON?
The cron script (scheduled.php) needs to be executed by cron every 5 minutes, if you have other ways to execute this script every 5 minutes, you can do so.
We need to make a .plist file, like so. In this example, the .plist file would be called com.myhost.sendy.plist, and a real path to scheduled.php is required
Comments
Hi David,
The cron script (scheduled.php) needs to be executed by cron every 5 minutes, if you have other ways to execute this script every 5 minutes, you can do so.
Thanks.
Best regards,
Ben
David, if you figure out how, please post it on the forum, I've tried w/o luck!
Thanks,
Isaac
Isaac, worked something out.
We need to make a .plist file, like so. In this example, the .plist file would be called com.myhost.sendy.plist, and a real path to scheduled.php is required
<?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"> <plist version="1.0"> <dict> <key>Label</key> <string>com.myhost.sendy</string> <key>ProgramArguments</key> <array> <string>/usr/bin/php</string> <string>/full/path/to/scheduled.php</string> </array> <key>StartInterval</key> <integer>300</integer> </dict> </plist>This file needs to be moved to /Library/LaunchDaemons
Then:
sudo launchctl load -w /Library/LaunchDaemons/com.myhost.sendy.plist
One can see if it's loaded:
sudo launchctl list | grep sendy
Hope this helps... it seems to work, and I would appreciate any comments from others on the viability of this.