OpenWrt power down process

Hello,
I would like to run some script when power off.
I am not sure OpenWrt power down process, which place I can add my script.
Is there any introduction about openwrt power down process? which place I can add my script

Thanks

To be clear, you want to turn off the router with a script?

What are you trying to accomplish? Security? Save power?

procd exposes a rather BSD like rc.d interface.

To run a script on power down, you can put it into /etc/rc.d/ starting with a 'K'. And it has to have the proper syntax.

More info: https://openwrt.org/docs/techref/initscripts

How do you do the actual power down or like this, how do you start the script?

If you only pull the power then any script doesn’t matter.

The only function we have for a “power off”is the shut down function in the dual boot luci package.

You can power the router down with logging in (via ssh) and typing halt or reboot.

Another example would be a cronjob that runs halt or reboot.