It is very important to know how to manage services in Linux/Unix systems, in order not to reboot the entire system when not necesarry.
In this article I will show you how to start, stop, restart a service in the most used Linux distros and FreeBSD and will use the sshd service as a sample:
How to start, stop, restart a service in Fedora/openSUSE/CentOS:
Syntax: # service name {start,stop,restart}
Stop sshd: # service sshd stop
AND # /etc/init.d/sshd stop
Start sshd: # service sshd start
AND # /etc/init.d/sshd start
Restart sshd: # service sshd restart
AND # /etc/init.d/sshd restart
How to start, stop, restart a service in Debian/Ubuntu/Linux Mint:
Stop ssh: # /etc/init.d/ssh stop
Start ssh: # /etc/init.d/ssh start
Restart ssh: # /etc/init.d/ssh restart
How to start, stop, restart a service in FreeBSD/PCBSD:
Syntax: # service name {start,stop,restart}
Stop sshd: # service sshd stop
AND # /etc/rc.d/sshd stop
Start sshd: # service sshd start
AND # /etc/rc.d/sshd start
Restart sshd: # service sshd restart
AND # /etc/rc.d/sshd restart
Yo can find out if a service is running or not with ps or /path/to/service status:
$ ps aux | grep ssh
OR: /etc/*.d/ssh status
Leave a Reply