I have put these two intentionally incorrect lines in my /etc/sysctl.conf:
fakevar=1
security.bsd.see_other_uids=badvalue
Then as root, I run "/etc/rc.d/sysctl reload" and I get the output:
sysctl: unknown oid 'fakevar' at line 1
sysctl: invalid integer 'badvalue' at line 2
This is exactly the kind of output I need, but I want to run the sanity test before reloading or restarting sysctl. The method I use above does both things at once. I also don't care for the fact the exit code of this "command" is 0 no matter what (the "program" exits with success whether or not errors are encountered).
As an aside, is it bad practice to reload or restart sysctl (using the command above or "service sysctl restart") instead of just restarting the system?
fakevar=1
security.bsd.see_other_uids=badvalue
Then as root, I run "/etc/rc.d/sysctl reload" and I get the output:
sysctl: unknown oid 'fakevar' at line 1
sysctl: invalid integer 'badvalue' at line 2
This is exactly the kind of output I need, but I want to run the sanity test before reloading or restarting sysctl. The method I use above does both things at once. I also don't care for the fact the exit code of this "command" is 0 no matter what (the "program" exits with success whether or not errors are encountered).
As an aside, is it bad practice to reload or restart sysctl (using the command above or "service sysctl restart") instead of just restarting the system?