0

I understand that -p stands for power off.

The man page says:

-p, --poweroff

       Power-off the machine, regardless of which one of the three
       commands is invoked.

But exactly what does it do in reboot?

When tried both reboot and reboot -p in a RHEL 7 machine, I failed to find any appreciable difference.

Masroor
  • 295
  • A related question is https://unix.stackexchange.com/questions/195898/ . – JdeBP Aug 21 '17 at 18:23
  • @JdeBP An excellent resource. And a must read. However, it does not answer my question. – Masroor Aug 22 '17 at 00:17
  • 1
    Which is why it is a question comment rather than an answer and is talking about related rather than duplicate questions. – JdeBP Aug 22 '17 at 07:57

1 Answers1

1

The documentation is wrong. As others have pointed out: halt, reboot and poweroff are all symlinked to systemctl. That program first looks at the name it was invoked from and sets the action it is going to take (one of halt, reboot or poweroff). It then parses its arguments one by one to see if any of them override the default. However, looking at the source code, a poweroff option can not override anything when the current action is reboot.

reboot --halt --poweroff will power off the machine though, because when systemctl parses the final argument the current action is set to halt (from the previous argument).

Chuck E
  • 216
  • There is more on the embarrassing position that we are in nowadays with this (c.f. https://unix.stackexchange.com/questions/372732/), at https://unix.stackexchange.com/a/196471/5132 . – JdeBP Mar 17 '18 at 10:48