shutdown the system instantly
It instructs the hardware to stop all CPU functions but leaves it powered on.
- -p power-off the machine
- –reboot reboot the machine
shutdown [OPTION] [TIME] [MESSAGE]
shutdown -h now
For graceful shutdown and restart of the machine.
- -p poweroff
- -f Reboot forcibly
- –halt halt the machine
- –verbose Outputs slightly more verbose messages, useful for debugging problems with shutdown.
Reboot in next 15 minutes
shutdown -r +15
shutdown -r now The Kernel loads the /sbin/reboot and /sbin/shutdown binaries from the disk and execute them. If it fails due to a problem with the drive, generates an error like:
bash: /sbin/reboot: Input/output error
shutdown -r now
bash: /sbin/shutdown: Input/output error
On the next boot, an fsck would correct whatever is wrong with the disk.
Sends an ACPI signal which instructs the system to power down.
–halt halt the machine
–reboot reboot the machine
Suspend & Hibernate Command
Suspend & Hibernate
Init with run level 6 is set for rebooting
/sbin/init 6 init 0 shutdown the Linux System
contains records all logins and logouts.
Use the command to parse this file
Disable Shutdown and Reboot for specific users or group
Add these lines to the Command Aliases section.
Cmnd_Alias SHUTDOWN = /sbin/shutdown,/sbin/reboot,/sbin/halt,/sbin/poweroff # User privilege specification scpl ALL=(ALL:ALL) ALL, !SHUTDOWN # Allow members of group sudo to execute any command %developers ALL=(ALL:ALL) ALL, !SHUTDOWN
Another way is to remove execution permissions on shutdown and reboot commands for all users except root.
chmod o-x /sbin/shutdown
chmod o-x /sbin/reboot
chmod o-x /bin/systemctl
Seldom Reboot on Servers Satisfying Linux System Administrators
Linux 4.0 enabled servers like Oracle Linux, and RHEL can go without reboot for years with Ksplice.
Red Hat kpatch and SUSE kGraft, provides the Linux to keep running even while critical patches installed.
Kpatch issues a stop_machine() command and looks at the stack of existing processes using ftrace to patch safely. Further, it redirects the running code to the patched functions and then removes the now outdated code.