In some post here, I read that if I wanted to run a shell script at start up, I would have to add it at the end of /etc/rc.local but before exit 0. However, when I do this it seems to have no effect. Specifically, I am using my Pi3 as a Access Point and for some reason, I always have to
sudo service hostapd restart after boot to make it work. Adding this line to /etc/rc.local does not have the same effect. Where can I add this line so it really only executes after everything else has loaded?
Here are the contents of /etc/rc.local
#!/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 sudo service hostapd restart exit 0