当前位置: 首页 > 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

http://www.dtcms.com/a/224615.html

相关文章:

  • 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铸造平台?
  • 2025.5.29 学习日记 docker概念以及基本指令
  • 算法:滑动窗口
  • MySQL项目实战演练:搭建用户管理系统的完整数据库结构【MySQL系列】
  • 如何实现一个请求库?【面试场景题】
  • 牛客小白月赛117
  • 实施ESOP投入收益研究报告
  • 趋势直线指标
  • C语言学习——C语言强制类型转换2023.12.20
  • 【Java学习笔记】内部类(重点)
  • 最小二乘准则例题