linuxcentosrunlevel

How to run a script when switching from run level 3 to 0


I need to run a script when the server is going for a shutdown i.e. run level 0. But the catch here is, I need to make a curl call in the script which is not possible in run level 0 as the network will be down.

So my question is how can I achieve this ?

Basically what I am looking for is a solution to run a script when the system goes from run level 3 to run level 0.

Any help is appreciated.


Solution

  • You can do that combining all this together

    That's it, this should work !