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'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:

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

1 Answer 1

Try to change your script as follow:

#!/bin/bash

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 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 at 16:32

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.