Evaluating rc.conf before rebooting...

I have a few FreeBSD routers in remote locations that require a long list of routes added to the routing table via rc.conf at boot. When I make a number of adjustments or edits, I have a fear that I've made an error or accidentally inserted a character into my rc.conf that will break boot so I'll have to travel there...

  1. Is there a way to evaluate rc.conf prior to rebooting a system to determine if I added something stupid? There was a time I had broken a router by accidentally adding a ` to the top of my rc.conf and missed it since it wasn't in an area I was working on.
  2. Is there a better way to add persistent custom routes rather than rc.conf?

Thank you!
 
/etc/rc.conf is a shell script. It normally just sets variables, so running it with sh /etc/rc.conf may find errors. Add -x to see what it's doing.
 
That means there were no errors found. :) Try it with -x. Better yet, try adding or removing a single quote and see if it notices. Um... best to do that on a copy in case the intentional error is forgotten.
 
Just a small side-comment, one of the very first things I was taught about Unix environments: "No news is good news". By default, and per definition, a Unix program or script won't output a single thing if you tell it to do something and it has successfully performed that task.

Of course that was more than 20 years ago and several things changed in the meantime, but in general this "rule" still holds true today (although many programs and scripts have turned a bit more user friendly over time).
 
Back
Top