When I send a reboot command(or shutdown) command to a Linux machine does it keeps that messages at somewhere and can I query it. I.e. I will send a reboot command and after that I will run another command to check will my computer at reboot(or shutdown) mode(because it will not reboot immediately it will take some time to reboot and I will check it)?
EDIT
Server sends one of that commands to client(my server and client coded at Java ) If I ping after I send i.e. shutdown command, maybe machine will shutdown but still alive(it will shutdown maybe after 2 seconds later.) If I can query my client did it received a shutdown(or reboot) command even it is still alive I will accept that OK it will shutdown(or reboot) If I can not get an answer to my query to client it means that it is not alive, so I will accept that it is shutted(or rebooting). How can I query my machine like that?
shutdown
with a delay (I guess,shutdown -h +10
for ten minutes in the future): "If shutdown is called with a delay, it will create the advisory file /etc/nologin which causes programs such as login(1) to not allow new user logins. This file is created five minutes before the shutdown sequence starts." (manpage of shutdown) So, within that five minute interval, perhaps you could check if there is such a file?