What you said seems to be the normal way most PCs work. This is controlled by the motherboard and the BIOS.
What kind of behavior would you like?
Do you want to issue a command to shut down and them reboot two minutes later? That would require some additional hardware that you would custom build. Those sort of things are sometimes called "watchdog timers". If a message is not seen after a length of the, the timer shuts the of the equipment, waits, then turns it back on. Does that describe what you want?