Learned this a few days ago…If your having troubles with your rc.local running through everything you’ve put in it, you might want to take out the top part saying:
#!/bin/sh -e
as the -e dictates that the shell exit on any of the commands return a nonzero status. Now, your commands really shouldn’t be doing this (hopefully) but if they are, taking out the “-e” can fix the problem and allow later commands to run without problems.
Source: Stackexchange