Last updated
Last updated
Master of everything and the first process/service ( PID = 1 ) to start after the Linux kernel boot. Hence, our guy systemd will starts up and supervises almost the entire system units : -> Services -> Mounts -> Sockets ->Targets use systemctl -t help to list all units. -) systemd-analyze blame -> in case you want to know what takes time on boot. -) systemd-analyze security -> check the security of a unit.
-) /usr/lib/systemd/system -> default unit files that have been installed from RPM -) /etc/systemd/system -> All costume unit files -) /run/systemd/system -> All units files that have automatically been generated in the run-time.
Prevent modifying a unit file in /usr/lib/systemd/system unless you know what you are doing.
A unit $status can be : Loaded - Active - Running - Exited - Waiting - Dead - Enabled - Disabled - Static.
Used command to manage all the units through systemd. Below, you will find almost all the commands to help you managing units.
systemctl --type=services --all -> list all the services (active, inactive)
systemctl list-units -> display all the active units that systemd know about.
systemctl --failed --type=services
systemctl status -l <service_name>
systemctl cat <service_name> -> current config of this unit.
systemctl show <service_name> -> show available configs
systemctl edit --full <service_name> -> to modify the default configs. watch this video :
systemctl daemon-reload -> To ensure that systemd reload with the new configuration.
systemctl enable --now <service_name> -> to make the service starts autmoatically at boot.
systemctl reload <service_name> -> reload the config files of a service.
systemctl disable <service_name> -> to disable the service from starting automatically at boot
1 - Make sure httpd service is automatically started. 2 - Edit its configuration file such that on failure, it will continue after 130s.
First lets edit the unit config file of httpd service, systemctl edit --full httpd [service] Restart = always Restartsec= 130s systemctl daemon-reload killall httpd systemctl restart httpd systemctl enable --now httpd systemctl status httpd systemctl cat httpd.service -> to verify the changes.
Learn how to start, stop, enable, disable a systemctl and how to list linux services.