best way to reboot ?

Hi

What is the best way to reboot a Linux computer?
i) Press the power switch
ii) type 'init 6' as any user, then enter the root password when prompted
iii) Pour metal filings in the top of the computer.
iv) su to root then type 'init 6'

Or you could just type

reboot

as root.

halt
poweroff
reboot
shutdown

Well, you got 1/4 correct. He asked the best way to 'reboot'.

i typically use

shutdown -y -g0 -i6

I don't know if that's correct or not...it's just what I've gotten used to.

if you use gnome

gnome-power-cmd.sh reboot

as plain user

  • "shutdown" is an executable script. Read it to see what the script exactly is calling. In most cases "shutdown" first does a check on running processes and mounts, and then cleanly shuts them down before sending the reboot signal to the kernel by means of an "init 6" command.
    You may read "man init" as well, to see what parameters "init" uses.

The "reboot" command may differ from one system to the other.

  • "reboot" on Solaris is a binary. Reboot warns all logged on users, performs a sync to disk(s), then hands it over to "init" (which does the actuale rebooting of the system). On Linux systems, "reboot" may be a script, I don't know that for sure.
  • "poweroff" in Solaris is a command you use after the disk(s) have synced. It eventually shuts off the power on the hardware. So no reboot here.
  • The halt and poweroff utilities normally log the system shutdown to the system log daemon, syslogd, and place a shutdown record in the login accounting file. (I snatched that from Solaris' "man halt").
    N.B. On Solaris the "halt" and "poweroff" utils do not cleanly shutdown the smf services (running processes). So you might check this in Linux.

On Solaris (and also some Linux systems) you also can directly use the "init [0123456] commands, but beware: "init 5" means something else on Solaris as in Linux.

  • DON'T press the powerswitch for a reboot. I haven't heard of any operating system that appreciates this action.

Cheers, A