如何在BusyBox关闭时调用停止脚本?

Man*_*rbe 3 shutdown init busybox system-shutdown

我在/ etc/inittab中运行带有条目的BusyBox

::sysinit:/etc/init.d/rcS
Run Code Online (Sandbox Code Playgroud)

rcS脚本在启动时调用/etc/rc.d/中的所有启动脚本.

如何通过调用/etc/rc.d/xxx停止调用BusyBox小程序"poweroff","halt"或"rebo​​ot"来告诉BusyBox init关闭所有服务?

Man*_*rbe 5

仅仅是为了记录 - 我最终将自己的关闭脚本添加到/ etc/inittab

::shutdown:/etc/init.d/rcD
Run Code Online (Sandbox Code Playgroud)

该脚本只是向后循环启动脚本:

#!/bin/sh
if [ -d /etc/rc.d ]; then                                        
    for x in $(ls -r /etc/rc.d/) ; do                               
        /etc/rc.d/$x stop                                       
    done                                                         
fi 
Run Code Online (Sandbox Code Playgroud)