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?
cronmacosscreen capture
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?
Best Answer
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:PATH
environment variable the same was as the shell,cron
doesn't know wherescreencapture
is. You need to specify the full path,/usr/sbin/screencapture
.As noted in the crontab(5) man page,
cron
treats%
as a newline character:So you need to escape each
%
with a\
to get your desired result.This
crontab
entry will give you a screen capture every hour, on the hour:Cron Error Logging
As an aside, if you're having issues with cron, check your system mail by running the
mail
command in Terminal. It's not very obvious, but by defaultcron
sends error messages there that can provide a starting point to figuring out what's going wrong.