LFCS Admin Exam preparation guide series, main page can be found here.
This post is part of Operation of Running Systems from the domain competency list for the exam. The full list can be found in the link above paragraph or the Linux Foundation page here.
In this blog, we will take a look at ways how to manage the state of the Linux server. As we are using the system, there are times when we need to shut down, reboot the server, and there are few ways to do this.
To shut down the system, we can use the shutdown command with -P for power-ff the machine. We can specify the time when to perform the shutdown operation. For example, adding “now” will perform shutdown immediately. The shutdown command can be used to perform different operations like reboot or halt.
As mention above, we can use the shutdown -r command to perform system reboot, but we can as well use the reboot command, which is easier to remember. This command does not accept time and will execute soon as we press Enter. As wee can see below, reboot command can be used to power off and halt when providing the correct option.
Another system state can be halt which we can achieve with command with the same name, and again this command not accepting time value and will put the system on halt after pressing Enter. Similar to reboot and shutdown command we can perform all three actions using the commands with options depending on what we want to achieve.
Init send control commands to the init daemons, and it can be used as well to perform shutdown and reboot of the Linux server. We have to specify numbers 0 and 6, respectively.
Thank you for reading and keep learning.