I have Raspberry Pi that loads a shell script on start up.

This script runs a python script, boot_camera.py, which is found in a repository.

I Have a server which sends the Raspberry Pi a command to issue a git pull command. The git pull command fails when the boot_camera.py is loaded on start-up.

However when I load the 'boot_camera.py' script manually after connecting with ssh the git pull command is executed successfully.

At first I thought the problem was with having to use 'sudo' permissions to run the command, so I used this solution which fixed the problem:

>>>Solution to not using sudo<<<

But when the script is booted on start-up the pull command still fails.

Update: This is the script that sets up the boot script:

sudo cp bootCameraModule.sh /etc/init.d/
sudo update-rc.d bootCameraModule.sh defaults

And this is the script itself:

case "$1" in
    echo "Starting camera"
    . /home/pi/.virtualenvs/env/bin/activate
    # run application
    cd /home/pi/rpi-repo/rpi/
    python boot_camera.py &
    echo "Stopping camera"
    # kill application
    sudo killall camera
    echo "Usage: /etc/init.d/bootCameraModule {start|stop}"
    exit 1

exit 0
  • 2
    You need to show us the scripts that you're running. Also your text is hard to read. Use shorter sentences and start sentences with capital letters. – Gilles 'SO- stop being evil' May 25 '15 at 19:13
  • Thanks for the comment, I edited my message and added the relevant Shell scripts. – Ethan May 25 '15 at 19:22
  • Can you show us boot_camera.py? – Will Jan 17 '16 at 10:37
  • Messing around with code that is critical for the function of your machine by grabbing a latest development version automatically and installing that is less than wise... – vonbrand Jan 17 '16 at 17:36
  • Might be an old question but I will guess the issue is related to a non full path to an executable in boot_camera.py. For example git is used instead of /path/to/git. This is due to the start environment being different the user environment. – Tigger Nov 25 '18 at 1:32

Without seeing the script itself, one strong possibility I'd suggest investigating is that the networking isn't fully level by the time your script executes. The reason it manually succeeds is that you've executed it after the networking is fully up.

I have a git repo my own pi camera application is dependent on for shoveling pictures & videos it captures to the cloud. My script just keep looping the git clone until it either succeeds or at least makes me aware its failed:

until git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
    echo "Download of Dropbox-Uploader repo failed. Retrying"
    echo "CTRL +C to exit if failing endlessly"

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.