In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to force the shutdown of linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Concepts and terminology
Kernel modules allow the Linux kernel to dynamically insert and delete code into it at run time. These modules are programs with independent functions that can be compiled separately, but cannot be run independently. The module runs in kernel space at run time as part of the kernel.
Operational scenario 1: using Kgotobed to force shutdown difficulty ★★★ demo release archlinux involves commands gotobed installation
To install kgotobed on archlinux, you first need to install the dkms and linux-headers packages:
Sudo pacman-S dkms linux-headers-- noconfirm
Then go to github to clone its source code:
Git clone https://github.com/nikital/kgotobed.git
Finally, we compile the source code manually:
Cd kgotobed/sudo make install
The make install command does three things:
Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community
Register for kgotobed.ko through DKMS
Install the gotobed command to / usr/local/bin
Register, enable, and run kgotobed.service in systemd
Use
You can see the set forced shutdown time by running gotobed directly:
[vagrant@archlinux kgotobed] $gotobed 22:00Current bedtime is 2018-04-13 01:00:00Setting bedtime to 2018-04-12 22:00:00Bedtime will be in 10 hours 32 minutes
But you can't change the time to later.
[vagrant@archlinux kgotobed] $gotobed 2:00Current bedtime is 2018-04-13 01:00:00Error: Attempting to postpone bedtime, it doesn't work like this...
To adjust the default time, you need to modify / etc/systemd/system/kgotobed.service.
The original kgotobed.service content is as follows:
[Unit] Description=kgotobed: Poweroff at bedtimeAfter=dkms.service [Service] Type=oneshotExecStartPre=/sbin/modprobe kgotobedEnvironment=TIME=01:00ExecStart=/usr/local/bin/gotobed-f ${TIME} [Install] WantedBy=multi-user.target
We change the TIME=01:00 to TIME=02:00, restart the system, and execute gotobed again to see that the time has been changed:
[vagrant@archlinux ~] $gotobed Current bedtime is 2018-04-13 02:00:00 delete kgotobed
Almost the only way to escape the forced shutdown is to uninstall kgotobed.
We can execute make uninstall in the source code directory to uninstall:
[vagrant@archlinux] $cd kgotobed/ [vagrant@archlinux kgotobed] $sudo make uninstalldkms remove kgotobed/1.0-- all-Uninstall Beginning-Module: kgotobedVersion: 1.0Kernel: 4.15.15-1-ARCH (x86: 64)-- Status: Before uninstall, this module version was ACTIVE on this kernel. Kgotobed.ko:-Uninstallation-Deleting from: / usr/lib/modules/4.15.15-1-ARCH/extra//-Original module-No original module was found for this module on this kernel. -Use the dkms install command to reinstall any previous module version. Depmod. DKMS: uninstall completed. -- Deleting module version: 1.0completely from the DKMS tree.--Done.rm-f / usr/local/bin/gotobedrm-f / etc/systemd/system/kgotobed.servicesystemctl daemon-reload [vagrant@archlinux kgotobed] $this is the end of the article on "how to forcibly shut down linux". Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Server.c#include # include int main (int
© 2024 shulou.com SLNews company. All rights reserved.