I'm trying to set up a Raspberry Pi to check a repo on startup and then fire up a node script with forever.
I got the second part working, but I tried a dozen git commands with no success.
Here is my crontab that I access like so:
crontab -u pi -e
@reboot /bin/sh /home/pi/code/script.sh
Now my script has
-rwxr-xr-x access rights and goes like so:
#!/bin/sh cd /home/pi/code /usr/bin/sudo -u pi -H /usr/bin/git pull origin master /usr/bin/sudo -u pi -H /home/pi/.nvm/v0.11.11/bin/forever start /home/pi/code/server.js
Forever starts the server.js on reboot, no problem, but the repo never gets updated. If I run the script using
sh /home/pi/code/script.sh it triggers git pull correctly...
I initially set up an alias for git pull to be git up like it is recommended, but figured it might be my problem and I went back to the simplest version I could. Still no success.
Any input is welcome.
EDIT: the output of the crontab indicates connectivity issue:
Could not resolve host: bitbucket.org how can I wait for network to be setup before I run the script?