Methods of payment Abuse

More about the systemctl utility

16.09.2023, 22:39
Systemctl is a system utility in the Linux operating system that is used to manage services or daemons. It is one of the main utilities in systems using the systemd init system. Systemd is a tool for managing processes and services, and includes an init system, a unit manager, and other components.
 

What the utility is responsible for

The systemctl utility in Linux is the main tool for managing services in the system and is responsible for the following tasks:
  1. Start and Stop Services: Allows you to start and stop a specific service in the system. For example, the command "systemctl start apache2" will start the Apache web server, and "systemctl stop apache2" will stop it.
  2. Restarting Services: Also allows restarting services. For example, the command "systemctl restart apache2" will restart the Apache web server.
  3. Checking the status of services: Provides information about the current status of running services. The "systemctl status apache2" command will provide information about the status of the Apache web server, such as whether it is active, which ports it listens on, and other debugging information.
  4. Service Autorun Control: Allows you to configure whether a certain service will automatically start when the system boots or not. The "systemctl enable apache2" command will enable autorun of the Apache web server every time the system boots.

How to use it?

To use systemctl, you will need access to the Linux command line. Here are some basic commands and their usage:
  1. Starting the service: systemctl start <service> - the command allows you to start the specified service. To start the Apache HTTP Server service, you need to run systemctl start apache2.
  2. Stopping the service: systemctl stop <service> - the command stops the specified service. systemctl stop apache2 will stop Apache HTTP Server.
  3. Restarting the service: systemctl restart <service> - restart. systemctl restart apache2 will restart Apache HTTP Server.
  4. Restarting the service: systemctl reload <service> - restarts the service. The difference between restarting and rebooting is that restarting stops and then starts the service again, and rebooting restarts it, without stopping completely.
  5. Checking the service status: systemctl status <service> - the command shows the current status of the specified service.
Next, let's talk about configuring the service.
 

How to configure

Basic commands for configuring and using systemctl.
Starting the service:
 
sudo systemctl start <service_name>
Stopping the service:
sudo systemctl stop <service_name>
Restarting the service:
sudo systemctl restart <service_name>
Enabling autorun of the service at system boot:
sudo systemctl enable <service_name>
Disabling autorun of the service when the system boots:
 
sudo systemctl disable <service_name>
Checking the service status:
 
sudo systemctl status <service_name>
View a list of all available services:
 
sudo systemctl list-unit-files --type=service
Viewing the service log:
 
sudo journalctl -u <service_name>
Viewing the latest system log entries:
 
sudo journalctl -xe

Rebooting the system:

sudo systemctl reboot

Shutting down the system:

sudo systemctl poweroff
Remember that you may need superuser rights (sudo) to execute systemctl commands. Make sure you specify the service name correctly when using these commands.