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)?EDITServer 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?
How to check will my computer is going to reboot(or shutting down)?
linux;shutdown;command;reboot
During the reboot, the runlevel is set to 6 (0 for a shutdown, 1 for maintenance mode, and 25 for normal operation).if [ $(runlevel | sed 's/.* //') = 6 ]; then  echo A reboot is in progressfiThis is not very likely to be useful, since there will be only a very small window (often less than one second) during which the machine is still accepting commands after the reboot has been initiated.If you need a notification after the computer has rebooted, make it send a message (over ssh, email, SNMP or whatever is convenient) as part of its startup process, after all the services you need are started.