1 00:00:06,400 --> 00:00:10,310 So behind all these systemd units there is configuration, and you can manage that. 2 00:00:11,449 --> 00:00:16,223 The systemctl cat command is showing current unit configuration, as this information 3 00:00:16,223 --> 00:00:20,996 is coming from multiple locations. It's recommended to use systemctlcat because that 4 00:00:20,996 --> 00:00:25,769 concatenates all the information so that you have everything in one view. 5 00:00:26,379 --> 00:00:30,039 Many parameters can be used in systemctl, and systemctl 6 00:00:30,039 --> 00:00:33,700 show will show all the available configuration parameters. 7 00:00:34,679 --> 00:00:40,215 Systemctl Edit allows you to edit the service configuration after modifying service configuration. If you do 8 00:00:40,215 --> 00:00:45,750 it the right way, you don't have to do anything. It will be activated immediately. 9 00:00:46,369 --> 00:00:51,334 But if you are directly editing configuration files, it's a smart idea to use 10 00:00:51,334 --> 00:00:56,299 systemctl daemonreload which is telling systemd to pick up all of the changes. 11 00:00:56,929 --> 00:01:03,410 You might also want to use systemctl restart on a service, which is required if you have changed configuration of 12 00:01:03,410 --> 00:01:09,890 the service itself. That means not in the unit file, but in the service configuration file. That's because of a 13 00:01:09,890 --> 00:01:16,370 golden rule in Linux. If you change anything, you need to restart something to be aware of it. 14 00:01:17,069 --> 00:01:18,489 Let me demonstrate how this works. 15 00:01:19,810 --> 00:01:26,129 I would like to show you systemctl cat for SSHD drop because I know SSHD service 16 00:01:26,129 --> 00:01:32,449 is something that I like a lot and that is here in the service definition. 17 00:01:33,409 --> 00:01:38,370 And let me copy these two lines because I want to put that in my HTTPD configuration. 18 00:01:39,329 --> 00:01:45,364 So I'm using sudo systemctl edit on HTTPD service and there we can see it's using the 19 00:01:45,364 --> 00:01:51,399 nano editor. I don't like that very much, but I'm not going to complain about it. What 20 00:01:51,400 --> 00:01:57,435 I need to do is paste the two lines that copied and I need to put them 21 00:01:57,435 --> 00:02:03,469 in a service section as well, because otherwise we risk them not being recognized correctly. 22 00:02:04,370 --> 00:02:10,060 What are these lines doing? Well, these lines are making sure that the service is going to restart 23 00:02:10,060 --> 00:02:15,750 if it fails by default. The setting was for 42 seconds. I don't like that too much. 24 00:02:16,090 --> 00:02:21,685 I'm setting it to 21 seconds, I'm saving my changes and 25 00:02:21,685 --> 00:02:27,280 then I'm going to use sudo systemctl cat on HTTPD service. 26 00:02:28,860 --> 00:02:32,849 What do we see? Well, we see the concatenated content of all the configuration. 27 00:02:33,409 --> 00:02:37,039 Here is the default service file as it comes from the packages. 28 00:02:37,939 --> 00:02:42,215 And in this default service file we have all the configuration. And 29 00:02:42,215 --> 00:02:46,490 then here we have what was created by my edit operation. 30 00:02:47,069 --> 00:02:52,784 So etc systemd system HTTPD service d override config and that will automatically be 31 00:02:52,784 --> 00:02:58,500 included and it will be applied with a higher priority than the default configuration. 32 00:02:59,080 --> 00:03:00,259 So in case of conflicts. 33 00:03:02,599 --> 00:03:06,389 The configuration you created yourself will always win. 34 00:03:06,930 --> 00:03:10,780 So let me get out of here by using Q. 35 00:03:12,819 --> 00:03:18,039 Well, as I told you, if you use systemctl edit you don't have to restart or reboot anything. 36 00:03:18,840 --> 00:03:20,439 We should just be all right. 37 00:03:21,000 --> 00:03:25,469 So what am I going to do? Well, I need to get 38 00:03:25,469 --> 00:03:29,939 back to systemctl status for HTTPD and oh yeah, it's not loaded. 39 00:03:30,629 --> 00:03:36,932 Well I need to start it obviously and let me use sudo systemctl enable now 40 00:03:36,932 --> 00:03:43,235 httpd to start and enable it and then I'm using my status again and this 41 00:03:43,235 --> 00:03:49,537 is showing that the main process is running using process ID 23204 let me kill 42 00:03:49,537 --> 00:03:55,840 -9 that process. I'll tell you more about that later, but for now I'm just 43 00:03:55,840 --> 00:04:02,142 going to do it kill -9 23204 because what do we want to know? We 44 00:04:02,142 --> 00:04:08,445 want to know if my auto restart is active. And here you can see it 45 00:04:08,444 --> 00:04:14,747 activating auto restart because of the parameter that I just changed, it is going to 46 00:04:14,747 --> 00:04:21,050 restart it on failure so it will be back within 20 seconds or so. 47 00:04:21,850 --> 00:04:26,910 And as you can see it's running again since eight seconds. That's what the auto restart is 48 00:04:26,910 --> 00:04:31,970 doing. It's an awesome option and that alone is a good reason why you should like systemd.