Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call stop scripts on BusyBox shutdown?

I'm running BusyBox with an entry in /etc/inittab

::sysinit:/etc/init.d/rcS

The rcS script calls all the start scripts in /etc/rc.d/ on startup.

How is it possible to tell the BusyBox init to shut down all services probably by calling /etc/rc.d/xxx stop on calling the BusyBox applets "poweroff", "halt" or "reboot"?

like image 552
Manuel Barbe Avatar asked Sep 13 '25 01:09

Manuel Barbe


1 Answers

Just for the records - I finally came along with adding my own shutdown script to /etc/inittab

::shutdown:/etc/init.d/rcD

The script just loops the startup scripts backwards:

#!/bin/sh
if [ -d /etc/rc.d ]; then                                        
    for x in $(ls -r /etc/rc.d/) ; do                               
        /etc/rc.d/$x stop                                       
    done                                                         
fi 
like image 55
Manuel Barbe Avatar answered Sep 17 '25 16:09

Manuel Barbe