I want to set cron to capture the current desktop every hour:
screencapture -Cd -tjpg ~/Desktop/screen-`date +"%Y%m%d-%H%M"`.jpg
I tired this method but it seems doesn't work on Mountain Lion. I also tried Lingo but with no luck. Any ideas?
cron behaves a bit differently than a standard prompt, which is why it's not doing what you're expecting. There are two issues with the command as is:
PATHenvironment variable the same was as the shell,
crondoesn't know where
screencaptureis. You need to specify the full path,
As noted in the crontab(5) man page,
% as a newline character:
Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.
So you need to escape each
% with a
\ to get your desired result.
crontab entry will give you a screen capture every hour, on the hour:
0 * * * * /usr/sbin/screencapture -Cd -tjpg ~/Desktop/screen-`date +"\%Y\%m\%d-\%H\%M"`.jpg
As an aside, if you're having issues with cron, check your system mail by running the
cron sends error messages there that can provide a starting point to figuring out what's going wrong.