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
start)
echo "Starting camera"
. /home/pi/.virtualenvs/env/bin/activate
# run application
cd /home/pi/rpi-repo/rpi/
python boot_camera.py &
;;
stop)
echo "Stopping camera"
# kill application
sudo killall camera
;;
*)
echo "Usage: /etc/init.d/bootCameraModule {start|stop}"
exit 1
;;
esac
exit 0
boot_camera.py
?boot_camera.py
. For examplegit
is used instead of/path/to/git
. This is due to the start environment being different the user environment.