first, create folder and .sh file by terminal
(on this sample, "screenshot" and "Screencapture.sh")
$ cd
$ mkdir screenshot
$ cd screenshot
$ touch Screencapture.sh
Second,
create shell script
#!/bin/bash
/usr/sbin/screencapture -m -C -T0 -x ~/screenshot/capture_`date +%Y%m%d%H%M`.png
Next, permission.
$ chmod +x Screencapture.sh
Then, open your editor and copy and paste.
<?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.example.app</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>/Users/xxxxx(username)/Screenshot.sh</string>
|
|
</array>
|
|
<key>StartInterval</key>
|
|
<integer>300</integer>
|
|
</dict>
|
|
</plist>
|
Great, save this file as "com.example.app.plist" and locate to "/Library/LaunchDaemons"
then, run.
launchctl load -w /Library/LaunchDaemons/com.example.app.plist
You will see screen shot each 5 min.
reference
http://www.splinter.com.au/using-launchd-to-run-a-script-every-5-mins-on/
http://www.splinter.com.au/using-launchd-to-run-a-script-every-5-mins-on/