source: - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Power.html
8.4. SHUTTING DOWN, SUSPENDING, AND HIBERNATING THE SYSTEM
In Red Hat Enterprise Linux 7, the
systemctl
utility replaces a number of power management commands used in previous versions of the Red Hat Enterprise Linux system. The commands listed in Table 8.8, “Comparison of Power Management Commands with systemctl” are still available in the system for compatibility reasons, but it is advised that you use systemctl
when possible.
Table 8.8. Comparison of Power Management Commands with systemctl
Old Command | New Command | Description |
---|---|---|
halt | systemctl halt | Halts the system. |
poweroff | systemctl poweroff | Powers off the system. |
reboot | systemctl reboot | Restarts the system. |
pm-suspend | systemctl suspend | Suspends the system. |
pm-hibernate | systemctl hibernate | Hibernates the system. |
pm-suspend-hybrid | systemctl hybrid-sleep | Hibernates and suspends the system. |
The
systemctl
utility provides commands for shutting down the system, however the traditional shutdown
command is also supported. Although the shutdown
command will call the systemctl
utility to perform the shutdown, it has an advantage in that it also supports a time argument. This is particularly useful for scheduled maintenance and to allow more time for users to react to the warning that a system shutdown has been scheduled. The option to cancel the shutdown can also be an advantage.Using systemctl Commands
To shut down the system and power off the machine, type the following at a shell prompt as
root
:systemctl poweroff
To shut down and halt the system without powering off the machine, run the following command as
root
:systemctl halt
By default, running either of these commands causes systemd to send an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run the selected command with the
--no-wall
command line option, for example:systemctl --no-wall poweroff
Using the shutdown Command
To shut down the system and power off the machine at a certain time, use a command in the following format as
root
:shutdown --poweroff hh:mm
Where hh:mm is the time in 24 hour clock format. The /run/nologin
file is created 5 minutes before system shutdown to prevent new logins. When a time argument is used, an optional message, the wall message, can be appended to the command.
To shut down and halt the system after a delay, without powering off the machine, use a command in the following format as
root
:shutdown --halt +m
Where +m is the delay time in minutes. The now
keyword is an alias for +0
.
A pending shutdown can be canceled by the
root
user as follows:shutdown -c
See the
shutdown(8)
manual page for further command options.
To restart the system, run the following command as
root
:systemctl reboot
By default, this command causes systemd to send an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run this command with the
--no-wall
command line option:systemctl --no-wall reboot
To suspend the system, type the following at a shell prompt as
root
:systemctl suspend
This command saves the system state in RAM and with the exception of the RAM module, powers off most of the devices in the machine. When you turn the machine back on, the system then restores its state from RAM without having to boot again. Because the system state is saved in RAM and not on the hard disk, restoring the system from suspend mode is significantly faster than restoring it from hibernation, but as a consequence, a suspended system state is also vulnerable to power outages.
For information on how to hibernate the system, see Section 8.4.4, “Hibernating the System”.
To hibernate the system, type the following at a shell prompt as
root
:systemctl hibernate
This command saves the system state on the hard disk drive and powers off the machine. When you turn the machine back on, the system then restores its state from the saved data without having to boot again. Because the system state is saved on the hard disk and not in RAM, the machine does not have to maintain electrical power to the RAM module, but as a consequence, restoring the system from hibernation is significantly slower than restoring it from suspend mode.
To hibernate and suspend the system, run the following command as
root
:systemctl hybrid-sleep
No comments:
Post a Comment