Run a command before reboot

Hey, I want to run a command just before every reboot. Where can I hook into that?

I had a look here, but am still not sure whether what I want to do is possible. Possible to run a cronjob when the "reboot" command is issued? - #4 by user674574

I need to do something to an attached modem right before the system reboots, doing it after boot is not going to work.

1 Like

https://openwrt.org/docs/techref/process.boot?s=shutdown#init

2 Likes

How do you intend to handle unexpected reboots (i.e. power outage/crash)?

Thanks, so I just define a shutdown() method in the init.d script, added a STOP metric and it is working

2 Likes

For my particular case it doesn't matter because a power down of the LTE module occurs.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.