Operating System - HP-UX
1819689 Members
3413 Online
109605 Solutions
New Discussion юеВ

What's different with reboot and "shutdown -r 0"

 
kyliu
Occasional Advisor

What's different with reboot and "shutdown -r 0"

I just took a command reboot ,
then my unix-9000 was gone.

HP-help center tell me , next time please use shutdown - r 0 .
He said "We usually use that command to restart.
I want to know more detail .
Does somebody tell me more?
Thank you.
7 REPLIES 7
Senthil Kumar .A_1
Honored Contributor

Re: What's different with reboot and "shutdown -r 0"

Hi Kyliu,

Usually you dont use "reboot" from Multiuser mode to reboot the system. It is used to reboot the system from single user mode. The reason being..

Reboot command reboots the system faster because it kills the currently running processes ungracefully... that is to say with signal "9" .. "kill -9" ...

On the other hand "shutdown -ry 0" will reboot the system..gracefully giving enough time for all the running processes to exit gracefully.. something equivalent to "kill -15" ... hence slower but safe...

regards.
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Sudeesh
Respected Contributor

Re: What's different with reboot and "shutdown -r 0"


Executing the shutdown command stops system activities in an orderly and consistent manner. It prompts the admin for a broadcast message to send to all users, kllls all users, gracefully shutdown all critical processes and synchronizes and unmounts filesystems.

The reboot command use kill -9 to kill running process, which takes the system down quickly, but can cause problems to the application and filesystems.

reboot may be used if the system is already in single-user mode.


Sudeesh
The most predictable thing in life is its unpredictability
Patrick Wallek
Honored Contributor

Re: What's different with reboot and "shutdown -r 0"

Review the man pages for each command for more info.

When you do a shutdown, the /sbin/rc?.d/K* scripts are executed to gracefully stop system processes.

A reboot does not do this.
Matthew_50
Valued Contributor

Re: What's different with reboot and "shutdown -r 0"

reboot send `kill -9` single to process,
`shutdown -r 0` is better choice.
Eknath
Trusted Contributor

Re: What's different with reboot and "shutdown -r 0"

Hi Kyliu,

Reboot is just killing the process forcebily which can result in data loss or file corruption. Whereas shutdown -r 0 is command which tells system to gracefully(not forcefully) shutdown the system( wait for processes to get complete by itself). The option -r is to reboot after graceful shutdown and 0 is the grace period in seconds.

See man pages for more information. Always prefer shutdown.

Cheers !!!
eknath
vinod_25
Valued Contributor

Re: What's different with reboot and "shutdown -r 0"

hi kyliu

When bringing an HP-UX system down, HP recommends using
the shutdown command instead of the reboot command.

The shutdown command does additional preprocessing to prepare
the system for the reboot command. Primarily, shutdown
executes /sbin/rc to shutdown subsystems, unmount filesystems, and
other tasks to bring the system to run level 0. This process
ensures that the system is as quiet as possible before running the
reboot command.

The reboot command will then kill all remaining non-system
processes, sync the buffer cache, and then calls the reboot
system call.

Note that issuing a reboot instead of a shutdown does not attempt
to stop any of the subsystems or unmount the file systems. While
reboot does attempt to kill non-system processes, other system
deamons may be active on the system. For example, the vxfsd
daemon may be attempting to flush the inode cache.

Any remaining activity on the system - when the reboot system
call is made - can cause the system to hang during the reboot if
the activity locks any resource that the reboot system call
needs to complete its processing, especially when reboot is trying
to flush the buffer cache.

Therefore, shutdown should be used instead of reboot to
provide a more comprehensive shutdown and limit the possibility of
system hangs during a reboot.

Regards

Vinod K
Geoff Wild
Honored Contributor

Re: What's different with reboot and "shutdown -r 0"

man pages are great for command information:

man 1m reboot

DESCRIPTION
The reboot command terminates all currently executing processes except
those essential to the system, then reboots the system, or halts, or
makes the partition ready for reconfig. When invoked without
arguments, reboot syncs all disks before rebooting the system.

and the Warning:

WARNINGS
reboot does not invoke the shutdown scripts associated with subsystems
to bring them down in a cautious manner. See shutdown(1M).


So, if Oracle was running - and started via startup scripts in /sbin/init.d - then a reboot would "crash" it - IE - Oracle would not be shut down cleanly...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.