How to get the system is doing reboot or shutdown?

Issues related to applications and software problems
Post Reply
gkm
Posts: 4
Joined: 2019/05/08 01:52:08

How to get the system is doing reboot or shutdown?

Post by gkm » 2020/06/12 10:31:14

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

User avatar
TrevorH
Forum Moderator
Posts: 29128
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

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

Post by TrevorH » 2020/06/12 12:25:17

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.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 7 - Software Support”