linuxbashshellargumentsreboot

What does the -h switch do, when the reboot function is invoked in Bash/shell?


I read a forum post some time ago (unfortunately I don't have the link any more), that instructed me to invoke "reboot -h now" in Bash on a Raspberry Pi running the Unix-based Raspbian operating system.

It is supposed to reboot the system immediately. What caught my eye though, was the -h switch.

There is no mention in the man page for the reboot function and I can't find anything about the switch on the Internet.

Since invoking the shutdown function together with the switch -h does not throw any errors, I have to assume, that the associated daemon (I believe it's systemd) does know the switch, making me conclude that it might be a deprecated feature, which is by default ignored today since it isn't needed any longer.

I also have to mention, that since I only used Raspberry Pi's with Linux up until now, I have no idea, whether this might even be a Raspberry-specific argument.

What is that specific switch supposed to do?


Solution

  • It was for stopping hard disks before restarting. The reboot/poweroff/halt was instantaneous, and data could be lost. sysvinit halt.c#L16 and sysvinit htdown.c.

    Nowadays, it's just ignored by systemd systemd systemctl-compat-halt.c:

                case 'i':
                case 'h':
                        /* Compatibility nops */
                        break;