Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
a2z
V2EX  ›  Linux

如何实时检测 runlevel 改变?

  •  
  •   a2z · Nov 30, 2014 · 2550 views
    This topic created in 4207 days ago, the information mentioned may be changed or developed.
    比如某内核模块,想在runlevel改变的时候写入一些文件,用register_reboot_notifier的话会在init.d/halt执行完系统都快关闭完的时候才执行。有没有办法能实时监测到runlevel的改变?
    1 replies    2014-11-30 11:57:10 +08:00
    efi
        1
    efi  
       Nov 30, 2014   ❤️ 1
    runlevel是用户态 sysv概念,发行版各不兼容。妈蛋的systemd里面把runlevel这个概念已经消灭了。

    你可以hook execve /sbin/shutdown。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2858 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 07:49 · PVG 15:49 · LAX 00:49 · JFK 03:49
    ♥ Do have faith in what you're doing.