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 have added a script to run every min

like this

crontab -e

and then add this code

* * * * * /bin/sh /home/user/Public/

the code did not run

then i restarted the cron

sudo /etc/init.d/cron restart

and try this too

sudo service cron restart

but still the code did not work

i can use graphical schedule task app but i dont want to use it but use command line

the code is just to take screen shot every min


now=$(date +"%m_%d_%Y-%T")
import -window root .folder/Image$now.png

and file permission is 777 too

if i run this script directly it works perfectly but in crontab

share|improve this question

Make sure that .folder exists in your home directory.

And the most important part is to modify your script like this


now=$(date +"%m_%d_%Y-%T")
export DISPLAY=:0
import -window root .folder/Image$now.png

Basically you are including this line in your script. export DISPLAY=:0

Restart your cron. You should see that working.

NOTE: Its a nice idea, I am using it on my machine now :) Thanks.

share|improve this answer

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.