The power of using Ubuntu on ShellsTM means you can manage many open source services right at your browser. And that means you will want to verify these services. In this article we will be looking at how to do this using systemclt. Systemctl is an easy and useful management tool for system administrators and anyone who is managing or testing services running on Ubuntu. With systemctl you can check the status of many services like ssh, apache, nginx, and a host of other services that may be critical to the type of applications that are running or should be running at all times. In this article we will be taking a look at the following:
- Starting and Stopping Services
- Restarting and Reloading
- Enabling and Disabling Services
- Checking the Status of Services
Starting and Stopping Services
To start a service it is very simple you just need to use the start command. If you are not root while executing these commands, make sure to use sudo. For example, if you need to start your web server after installing apache2 you can type the following in your terminal.
sudo systemctl start apache2
If you need to stop a service, use the stop command.
sudo systemctl stop apache2
Reloading and Restarting Services
To restart a service use the restart command.
sudo systemctl restart apache2
You can also reload a service like apache2 using the reload command. Reload will update all config file changes recently made without having to restart the service.
sudo systemctl reload apache21
Enabling and Disabling Services
The above commands are useful for starting or stopping services during the current session. To start services automatically at boot, you must enable them or use the enable command.
sudo systemctl enable apache2
To disable a service from starting automatically at boot using the disable commands.
sudo systemctl disable apache2
Enabling will not start a service in your current session you must run the start command to start the service in your session.
Checking the Status of your Services
To check verify the status of your service use the status command.
sudo systemctl status apache21
You should get output similar to the following if the service is running.
This is just a brief introduction of systemctl commands used with systemd on Ubuntu to manage system daemons like apache. If you would like to see more systemctl options or commands please look at systemctl –help on your terminal