0

I am having trouble using a cron job in Raspbian Jessie to run a bash script that works fine when I run it manually on the command line.

I have read a few responses but the advice doesn't help,,, or maybe I am being dim!

Here's what I did:

Created a bash script:

#!/bin/sh
/usr/bin/avconv -r 5 -i /var/www/html/images/image%05d.jpg /home/pi/Documents/Python/Sunflowers.mp4 -y

called the file makeVid.sh and made it executable with

chmod +x /home/pi/Documents/Python/makeVid.sh.

Also confirmed that the executable permissions worked by looking at the file properties.

Using gnome-schedule I created a cron job

0 * * * * /bin/sh /home/pi/Documents/Python/makeVid.sh

Although running the script manually works fine the cron job fails.

I tried variants of the command line in the cron job:

0 * * * * /home/pi/Documents/Python/makeVid.sh
0 * * * * /Documents/Python/makeVid.sh
0 * * * * /bin/sh /Documents/Python/makeVid.sh
0 * * * * sh /home/pi/Documents/Python/makeVid.sh
0 * * * * sh /Documents/Python/makeVid.sh

I also tried all those variants with variations of the bash script

#!/bin/sh
**sh /usr/bin/avconv** -r 5 -i /var/www/html/images/image%05d.jpg /home/pi/Documents/Python/Sunflowers.mp4 -y

#!/bin/sh
**sudo** /usr/bin/avconv -r 5 -i /var/www/html/images/image%05d.jpg /home/pi/Documents/Python/Sunflowers.mp4 -y

#!/bin/sh
**sh avconv** -r 5 -i /var/www/html/images/image%05d.jpg /home/pi/Documents/Python/Sunflowers.mp4 -y

Would appreciate any guidance, pointing or even laughter behind my back as long as it helps :-)

Many thanks in advance!

cheers wayjo

0

I ended up just restarting cron and it worked fine. Not sure why this worked when restarting the whole thing didn't but there we go.

Thanks for the heads up Goldilocks!

cheers wayne

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.