Freebsd rc usage: Difference between revisions

From wikinotes
(Created page with "= Managing Services = <blockquote> All daemons are enabled, and primarily configured in the <code>/etc/rc.conf</code>. rcvars (variables which can be overridden in rc.conf) are listed in the program's rcscript <code>/usr/local/etc/rc.d</code>. <source lang="bash"> # /etc/rc.conf: sshd_enable="YES" sshguard_enable="YES" sshguard_whitelist="/etc/sshguard.whitelist" </source> Services can be managed from the commandline very simply: <source lang="bash"> service sshguard s...")
 
No edit summary
Line 1: Line 1:
= Managing Services =
 
= Enabling Services =
<blockquote>
<blockquote>
All daemons are enabled, and primarily configured in the <code>/etc/rc.conf</code>.
All daemons are enabled, and primarily configured in the <code>/etc/rc.conf</code>.
Line 7: Line 8:
<source lang="bash">
<source lang="bash">
# /etc/rc.conf:
# /etc/rc.conf:
sshd_enable="YES"
sshd_enable="YES"
sshguard_enable="YES"
sshguard_enable="YES"
sshguard_whitelist="/etc/sshguard.whitelist"
sshguard_whitelist="/etc/sshguard.whitelist"
</source>
</source>
</blockquote><!-- Enabling Services -->


Services can be managed from the commandline very simply:
= Managing Services =
<blockquote>
<source lang="bash">
<source lang="bash">
service sshguard start             # start  service
service sshguard start
service sshguard stop               # stop    service
service sshguard stop
service sshguard restart           # restart service
service sshguard restart
</source>
</source>
</blockquote><!-- Basic Usage -->
</blockquote><!-- Managing Services -->
 
= Rc Variables =
<blockquote>
You can use <code>sysrc</code> to programmatically retrieve <code>/etc/rc.conf</code> variables.
 
<syntaxhighlight lang="bash">
sysrc defaultrouter  # print current value
</syntaxhighlight>
</blockquote><!-- Rc Variables -->

Revision as of 18:32, 22 October 2022

Enabling Services

All daemons are enabled, and primarily configured in the /etc/rc.conf. rcvars (variables which can be overridden in rc.conf) are listed in the program's rcscript /usr/local/etc/rc.d.

# /etc/rc.conf:

sshd_enable="YES"
sshguard_enable="YES"
sshguard_whitelist="/etc/sshguard.whitelist"

Managing Services

service sshguard start
service sshguard stop
service sshguard restart

Rc Variables

You can use sysrc to programmatically retrieve /etc/rc.conf variables.

sysrc defaultrouter  # print current value