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've set a script to run every 10 minutes using cron, but it does not run. It works when I run it manually. bin path is /usr/bin/.

The script contains:

scrot 'screenshot.png' -e 'mv $f /mnt/ftp/screenshots/'
share|improve this question
How do you setup the cron ? – Quentin Feb 27 '14 at 16:00
*/10 * * * * /root/ – user252972 Feb 27 '14 at 16:02

Try to change your script as follow:


export DISPLAY=:0    

scrot 'screenshot.png' -e 'mv $f /mnt/ftp/screenshots/'

And this because the problem occur because cron uses only a very restricted set of environment variables, through which DISPLAY doesn't exists.

share|improve this answer
works! thx alot! – user252972 Feb 27 '14 at 16:08
@user252972 If this answered your question, you may mark this answer as accepted, by clicking the green check mark next to it. That will indicate that your problem is solved. – Radu Rădeanu Feb 27 '14 at 16:32

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.