当前位置: 首页 > news >正文

Linux防止误关机

Linux防止误关机

    • 安装reboot-guard
    • 结果验证
    • 关机

安装reboot-guard

兼容python2python3

https://github.com/stephanritscher/reboot-guard

# 下载
wget -cP /usr/sbin/ https://raw.githubusercontent.com/stephanritscher/reboot-guard/refs/heads/master/rguard# 赋予可执行权限
chmod +x /usr/sbin/rguard# 下载service文件
wget -cP /etc/systemd/system/ https://raw.githubusercontent.com/stephanritscher/reboot-guard/refs/heads/master/rguard.service# 重载服务
systemctl daemon-reload# 设置开机自启动
systemctl enable --now rguard.service

当关机保护被停止时,手动启动关机保护

# 启动关机保护
rguard -1

在这里插入图片描述


结果验证

关机命令重启命令
poweroffreboot
init 0init 6
shutdown nowshutdown -r now
halt

systemctl关机命令systemctl重启命令
systemctl poweroffsystemctl reboot

在这里插入图片描述


关机

# 停止关机保护
rguard -0# 执行关机命令
poweroff

相关文章:

  • DO指数GPU版本
  • 一周学会Pandas2之Python数据处理与分析-数据重塑与透视-pivot() - 透视 (长 -> 宽,有限制)
  • cpp this指针
  • Python训练第四十天
  • 「Java教案」数据类型、变量与常量
  • Linux系统-基本指令(4)
  • Linux搭建DNS服务器
  • 基于FashionMnist数据集的自监督学习(生成式自监督学习AE算法)
  • C++基础算法————贪心
  • 那些常用的运维工具
  • b. 组合数
  • C++:参数传递方法(Parameter Passing Methods)
  • 用户认证的魔法配方:从模型设计到密码安全的奇幻之旅
  • HackMyVM-First
  • Linux【工具 04】Java等常用工具的多版本管理工具SDKMAN安装使用实例
  • SpringBoot整合MyBatis完整实践指南
  • Android任务栈管理策略总结
  • # CppCon 2014 学习: Quick game development with C++11/C++14
  • 构建多模型协同的Ollama智能对话系统
  • WEB3——为什么做NFT铸造平台?
  • wordpress tag数字url/网站优化公司排名
  • 文化网站建设方案/网站建设一般多少钱
  • 域名哪个网站好/在线网站建设平台
  • eclipse做网站代码/如何百度推广
  • 长宁苏州网站建设/小红书推广运营
  • 企业建设网站的功能是什么/系统优化