0

I am using crontab to open an image at every minute using a shell script. My script is working if I run it manually. But it is not executing in crontab. I have another script running well in crontab but not this one. Can anyone tell me what I am doing wrong?

My crontab line:

* * * * * /home/pi/Desktop/shellscript

My shell script:

#!bin/sh -x

PATH=/bin:/sbin:/usr/bin:usr/sbin

/bin/sh /etc/pofile

export display=0.0

/usr/bin/eog -f /home/pi/Desktop/picture.jpg

sleep 100

killall eog
  • It's difficult to know what is the issue; could you follow the steps at Debugging crontab jobs and share the output in your post? – Aurora0001 Jan 22 '18 at 16:09
  • It's export DISPLAY=:0.0. Shell scripts are case-sensitive, as almost anything in UN*X. Mind the :, too. Also /etc/pofile isn't going to work, most likely. – Janka Jan 22 '18 at 19:54
0

One thing to check. Do an 'ls -la' on the script that is working and on the one that is not. You'll see something like '-rw-r--r--'. This is three sets of 'rwx' which means read/write/execute. The first set is for the owner of the file, the second for the group that owner is in, the third for everyone. To run a script, chrontab needs 'x' execution rights. To add rights, you can say 'chmod a+x filename' which means 'changemode all+execute filename'. Not sure if that is your underlying problem, but that's a common issue with chrontab scripts not running.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.