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

like this

crontab -e

and then add this code

* * * * * /bin/sh /home/user/Public/call.sh

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

#!/bin/sh

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

1 Answer 1

Make sure that .folder exists in your home directory.

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

#!/bin/sh

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
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.