1

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

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .