FreeBSD (and NetBSD) stores all service related scripts that stop, start or restart services under /etc/rc.d or /usr/local/etc/rc.d/ directory. From these directories, you can start/stop any network or other system related services. General syntax:
/etc/rc.d/service-name {start} {stop} {status} {reload} {forceXXX} {rcvar}
Where option can be use as follows,
- start : Start a service
- stop : Stop a service
- status : Get status of a service such as if service is running or not
- reload : Reload a service, useful when you make any changes to configuration files
- forceXXX : To start, stop or restart a service regardless of the settings in /etc/rc.conf (see below for more info), the commands should be prefixed with "force". For instance to restart sshd regardless of the current /etc/rc.conf setting, you can use forcerestart (replace XXX with start, stop or restart)
- rcvar : Tells if service will be automatically starts when FreeBSD comes up (boot ups) i.e. to to check if a service is enabled in /etc/rc.conf or not.
Examples:
Start sshd service:
# /etc/rc.d/sshd start
Stop sshd service:
# /etc/rc.d/sshd stop
Restart sshd service:
# /etc/rc.d/sshd restart
However, service will not start, stop or restart if it is not configured in /etc/rc.conf file. For instance to restart sshd regardless of the current /etc/rc.conf setting, you can use forcerestart as follows:
# /etc/rc.d/sshd forcerestart
Or just start regardless of the current /etc/rc.conf setting
# /etc/rc.d/sshd forcestart
Or just stop regardless of the current /etc/rc.conf setting
# /etc/rc.d/sshd forcestop
More on /etc/rc.conf file
All freebsd services usually started automatically as specified in rc.conf. For example, enabling the SSHD daemon at startup is as simple as adding the following line to /etc/rc.conf:
sshd_enable="YES"
However, you can also use sysinstall command to add services that can start automatically as specified below:
1) Start sysinstall by typing sysinstall
# sysinstall
2) Select Configure
3) Select Startup
4) Select the service you wish to start automatically by pressing space bar

5) When done select Ok and Exit to shell prompt
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 4 comments… read them below or add one }
Very informative I also find official Handbook quite helpful too
I don’t wanna troll but like to know who is using FreeBSD these days?
Troll indeed. Take a look at netcraft. FreeBSD is alive and well in the server market.
Unknown 12.13.05 at 12:34 am
> I don’t wanna troll but like to know who is using FreeBSD these days?
Yahoo and google, springs to mind.