Linux Service Control Commands
As a Linux administrator, one task you will most certainly be required to know is the controlling of services via the command line. Because many of the servers you will work with will be headless, the services contained within won’t have a GUI app to help you out. So when the likes of Apache, NGINX, MySQL and Docker need to be started, restarted or stopped, you’re going to need to have this skill in your back pocket.
TechRepublic Premium looks at some of the ways you can control the start, stop and restarting of services with the Linux operating system.
From the guide:
The first command we’ll look at is systemctl, a tool that can work with just about any service on your system. First off, systemctl must be run with admin privileges. So if you’re working with a distribution that uses sudo, you’ll always use systemctl with the sudo command.
If your distribution doesn’t use sudo, you’ll have to first change to the root user with the su command. The basic command structure of this tool is:
sudo systemctl ACTION SERVICEi>
Where ACTION is the action you want to take and SERVICE is the service you want to work with. An action can be start, stop, restart, reload, enable or disable. A service can be any server installed, such as apache2, mysql or docker. It’s important to understand the difference between the actions.