Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to execute a cron job with Scrot (screenshot utility) but it won't work.

At first I thought it was a directory problem. I wrote my.png by itself at first, which could have been dropping it anywhere. So I changed the command to use the absolute paths. Since I've defined absolute paths, it seems like it would have to work correctly, but it's not. If I try to execute this as written on the command line, it works.

32 8,14,16 * * 1-5 /usr/bin/scrot /home/johndoe/my.png

What am I doing wrong?

Note that the times are not the problem, I keep putting it one or two minutes ahead of the current system time to test, and for other commands, it works fine.

share|improve this question
up vote 5 down vote accepted

Change the line in your crontab to this:

32 8,14,16 * * 1-5 DISPLAY=:0 /usr/bin/scrot /home/johndoe/my.png
share|improve this answer
Thanks. This worked, and was very helpful. – jumar Sep 28 '12 at 14:08
Great! Glad it worked. Please consider marking the answer as accepted to help clean up and clarify the site's contents. – SirCharlo Sep 28 '12 at 14:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.