Is anyone using launchd on OS X to run run-periodic-task or any other MT script instead of crontab? I am wondering how you setup your plist.
Is anyone using launchd on OS X to run run-periodic-task or any other MT script instead of crontab? I am wondering how you setup your plist.
I am using daemontools on Linux (there is an article on it over at Learning Movable Type, but nothing on Mac OS X. Hmmm...
In a cursory look at the specification though, I imagine it would look something like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple. com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.movabletype.run-periodic-tasks</string> <key>Program</key> <string>/path/to/tools/run-periodic-tasks</string> <key>ProgramArguments</key> <array> <string>run-periodic-tasks</string> <string>-daemon</string> </array> <key>StartInterval</key> <integer>3600</integer> </dict> </plist>I found this document very helpful:
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html
Okay I got it working and this is what I did.
I create a file named com.movabletype.run-periodic-tasks.plist using the text-editor on my desktop. In that file I added the following:
<?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.movabletype.run-periodic-tasks</string> <key>Program</key> <string>/path/to/tools/run-periodic-tasks</string> <key>ProgramArguments</key> <array> <string>run-periodic-tasks</string> </array> <key>StandardErrorPath</key> <string>/dev/null</string> <key>StandardOutPath</key> <string>/dev/null</string> <key>StartInterval</key> <integer>300</integer> <key>WorkingDirectory</key> <string>/path/to/mt</string> </dict> </plist>Now we need to move the file into place and set the permissions on it. You may be prompted for your password again:
I can start and stop the script with: