1 00:00:07,040 --> 00:00:11,265 Let me demonstrate what you can do to manage services with systemd. For your convenience, I 2 00:00:11,265 --> 00:00:15,490 have listed most of the commands on the slides to help you around a little bit. 3 00:00:16,870 --> 00:00:21,789 Let me start by using sudo systemctl t help systemctl is the 4 00:00:21,789 --> 00:00:26,710 main utility to manage systemd and it comes with great help. 5 00:00:27,570 --> 00:00:32,443 It uses tab completion, but you can also use help in many cases where it 6 00:00:32,443 --> 00:00:37,316 will tell you what is going on. Here we have t, which stands for type, 7 00:00:37,316 --> 00:00:42,189 and that is showing all the different types of units that systemd is managing. 8 00:00:43,429 --> 00:00:48,549 Now let me use systemctl list unit files. 9 00:00:50,350 --> 00:00:54,890 This is showing all the different unit files that are installed on your system in their current state. 10 00:00:55,390 --> 00:00:57,270 You can see that these unit valves are grouped. 11 00:00:57,880 --> 00:01:01,849 We have the mounts, we have the pads, and most important, we have all of 12 00:01:01,849 --> 00:01:05,819 these services that make up for what your server is supposed to be doing. 13 00:01:06,819 --> 00:01:12,743 The unit valves is giving an overview from vals perspective, including files that are 14 00:01:12,743 --> 00:01:18,666 not currently active. You can also use systemctl list units that will only show 15 00:01:18,666 --> 00:01:24,590 active units and that allows you to really investigate what is going on. 16 00:01:25,090 --> 00:01:31,349 And also it shows if anything has failed, like right here and there. You can further investigate if you want. 17 00:01:32,810 --> 00:01:39,049 Now, most important thing with systemd is to make sure that you can start and run services. 18 00:01:40,409 --> 00:01:47,104 In order to do so, I'm going to do a quick installation sudo dnf install y HTTPD 19 00:01:47,104 --> 00:01:53,799 this is installing the HTTPD web service and we are going to use it as dummy service. 20 00:01:54,980 --> 00:02:01,800 So a good way to get started is by using systemctl status on httpd, which is showing 21 00:02:01,800 --> 00:02:08,620 that the HTTPD service is loaded, well loaded. That means that systemd is aware of its configuration 22 00:02:08,620 --> 00:02:15,439 file and the configuration file is right here. User lib SystemD system and httpD service it is 23 00:02:15,439 --> 00:02:22,259 disabled, which means that it won't be started automatically. The preset is disabled, which means that that 24 00:02:22,260 --> 00:02:29,080 is the current state as it comes from the package and it's inactive and dead. 25 00:02:29,159 --> 00:02:30,379 So it's not doing anything. 26 00:02:31,699 --> 00:02:35,519 You want to change that? Well, you use sudo systemctl 27 00:02:35,519 --> 00:02:39,339 this time because we are changing the operating system status. 28 00:02:40,939 --> 00:02:46,500 Enable HTTPD that is going to flag the HTTPD service 29 00:02:46,500 --> 00:02:52,060 for automatic starting, but it doesn't change the current state. 30 00:02:52,900 --> 00:02:57,180 If you do want to change the current state, well, you need to start it manually. 31 00:02:59,699 --> 00:03:06,376 Now if you use status again, you can see everything that it is doing. It's a lot of information 32 00:03:06,376 --> 00:03:13,053 that it's displaying, including the status and where it is listening. The main process ID the amount of memory 33 00:03:13,053 --> 00:03:19,729 that it is using and even information that has been logged for this specific service by systemd Journald. 34 00:03:20,449 --> 00:03:26,340 Now, for whatever reason, you want to remove the service from its active state. You 35 00:03:26,340 --> 00:03:32,230 can use sudo systemctl and let me combine stuff a little bit this time. Disable 36 00:03:32,229 --> 00:03:38,120 now on httpd. That will disable it and that will stop it at the same. 37 00:03:38,979 --> 00:03:43,349 And now we are back and HTTPD is not active anymore.