sysrc name_enable="YES" versus service name enable

They do the same thing but enabling a service only works until you reboot.
That is why you add it to /etc/rc.conf with the sysrc command.
To startup a service on boot.

Does service xxx enable survive reboot? No it does not.
 
Oh, I was testing service xxx enable/disable after I had already issued sysrc. So to me it appeared they had the same effect. Not the case at all!

Thanks a lot 🐟🍳
 
I'm responding to this old thread for posterity. A quick test tells me that service <name> enable also writes to /etc/rc.conf.

Code:
% grep webcamd_enable /etc/rc.conf
%

% sudo service webcamd enable
webcamd enabled in /etc/rc.conf
% grep webcamd_enable /etc/rc.conf
webcamd_enable="YES"

A key point is that this enables installed services. That is, service <nonexistent> enable won't write anything to /etc/rc.conf. On the other hand, sysrc is a tool for writing to /etc/rc.conf.

Code:
% sudo sysrc blah=whatever
blah:  -> whatever

% grep whatever /etc/rc.conf
blah="whatever"
 
Back
Top