Page 1 of 1

How to get the system is doing reboot or shutdown?

Posted: 2020/06/12 10:31:14
by gkm
I wrote a service script in /etc/init.d
How can I get the system is doing reboot or shutdown in the script
I need to do some different work when reboot and shutdown

Re: How to get the system is doing reboot or shutdown?

Posted: 2020/06/12 12:25:17
by TrevorH
For CentOS 7 you probably should be using unit files not initscripts. And I doubt if there is a way since they are effectively the same thing - restart is shutdown then restart, shutdown is just shutdown.