1

I have the following: server pi and client pi both running latest update version Raspbian Stretch

I have a .sh script on the client pi to update the time from my server pi. When I run this manually it works but i'm battling to have this process automated on client pi reboot.

Manually running:

root@MediaClient:/etc# date +%Y%m%d%T -s "`ssh root@10.0.0.24 'date "+%Y%m%d %T"'`"
root@10.0.0.24's password:
2017092416:27:03

my rc.local looks like this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

sh /BBTV/sh/Startup.sh

exit 0

I made sure rc.local is executable:

root@MediaClient:/etc# ls -l /etc/rc.local
-rwxr-xr-x 1 root root 444 Sep 24 16:31 /etc/rc.local

I made sure rc.local has a shebang line:

root@MediaClient:/etc# head -n1 /etc/rc.local
#!/bin/sh -e

what am I missing to do? Any help will be appreciated.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
user72291
  • 19
  • 1
  • 3

1 Answers1

0

The answer was right there... my script to set the correct gateway didn't run... so this in turn didn't point the startup script to the correct gateway. Raspbian Stretch has a default gateway 0.0.0.0. and that was the problem. Once I set the gateway my script ran perfectly.

user72291
  • 19
  • 1
  • 3
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Dec 11 '19 at 19:21