Am 14.07.2021 um 19:41 schrieb Tapani Tarvainen:
On Wed, Jul 14, 2021 at 05:12:27PM +0100, Michael Tremer (michael.tremer@ipfire.org) wrote:
Does the -r switch in shutdown(8) actually work?
Yes. It has worked in all Linux systems I've used for years (and several non-Linux Unix-based systems like HP-UX).
I also tried this on my IPFire test system before submitting the patch and can confirm that -r (and -F) work as expected :)
In the past "shutdown -r now" and "reboot" differed, e.g., reboot didn't sync or run shutdown scripts (and thus shutdown was sometimes recommended as the "safe" or "clean" way to reboot), but nowadays they're identical apart from some different options (notably, reboot has the "-f" option for "dirty" reboot, but it's not default anymore). People generally use whichever they're used to.
Today shutdown, reboot, halt and poweroff are all symlinks to systemctl in Debian and Ubuntu at least, but options and defaults differ depending on which name it is called with.
E.g., Debian Buster:
$ ls -l /sbin/{shutdown,reboot,halt,poweroff} lrwxrwxrwx 1 root root 14 Mar 18 21:59 /sbin/halt -> /bin/systemctl lrwxrwxrwx 1 root root 14 Mar 18 21:59 /sbin/poweroff -> /bin/systemctl lrwxrwxrwx 1 root root 14 Mar 18 21:59 /sbin/reboot -> /bin/systemctl lrwxrwxrwx 1 root root 14 Mar 18 21:59 /sbin/shutdown -> /bin/systemctl
Thanks for the detailed explanation!