Is reboot the same as init 6 for ubuntu?
I'm running Ubuntu 12.04 on Amazon EC2. When ssh'ed into the box I can type runlevel
and I get:
N 2
Looking at man reboot
I see that:
When called with --force or when in runlevel 0 or 6, this tool invokes the reboot(2) system call itself and directly reboots the system. Otherwise this simply invokes the shutdown(8) tool with the appropriate arguments.
If I read man shutdown 8
I see:
shutdown arranges for the system to be brought down in a safe way. All logged-in users are notified that the system is going down and, within the last five minutes of TIME, new logins are prevented.
My basic understanding about the difference between reboot
and init 6
is:
- On other distros and perhaps older distros
reboot
would just unmount the disks and basically flick the power switch without running any shutdown scripts init 6
will run all of the shutdown scripts in/etc/init/rc.*
as it reduces system's runlevel- On newer versions of Ubuntu the
reboot
command without--force
or-f
will run the shutdown command which does would basically do the same thing asinit 6
- It's probably better to get in the habit of using
init 6
instead ofreboot
as it is safer and would work better cross-distro, but the default behavior ofreboot
has been changed to try and prevent errors / dataloss if someone does use it.
Is that about right? If not, what am I missing?
init 6
would cause this. When you usereboot
instead ofinit 6
, does it always get past the BIOS? – Eliah Kagan Sep 08 '13 at 17:23reboot
halts sometimes on my Ubuntu Server 14.02 of single user and local login only. Is it safe I always dosync
followed by areboot -f
? – user3549648 Aug 12 '15 at 18:49