Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer 1

up vote 3 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
add comment

Your Answer

 
discard

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.