Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What parameters do the "shutdown" command [or other command?] NEED, TO BE SURE that the machine reboots or shuts down for SURE?

e.x.: version for Linux:

# cat /etc/SuSE-release
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 4

e.x.: version for AIX:

$ oslevel -s
6100-05-01-1016

e.x.: version for SunOS:

cat /etc/release
                  Solaris 10 10/09 s10s_u8wos_08a SPARC
       Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                    Use is subject to license terms.
                       Assembled 16 September 2009
# 

e.x.: version for HP-UX:

uname -r
B.11.11

Please share experiences also with shutdown/reboot [command didn't worked, because machine was unreachable, because it got "stuck" somewhere when trying to reboot - I mean not after rebooting, "before" the machine get's rebooted...so that why can it stuck in the start/middle of reboot the process ]

share|improve this question

3 Answers 3

The only time when a shutdown or reboot might 'fail' is when an active process refuses to respond to even SIGKILL which is what the shutdown/reboot procedure issues to processes that haven't responded timely to the previous SIGTERM, which it issues to all remaining active processes after it finished executing the init scripts required for runlevel 6 or 0 depending on whether you called shutdown -h or shutdown -r (or reboot).

Pretty much the only time this happens is when the process is stuck on waiting for a kernel system call that won't complete (most common cause for these is bad hardware causing the driver to crash while a process is trying to read data from it)... But at that point, you pretty much need a physical override because any remote access would perforce operate at the system level and this is a problem at the kernel level.

When I issue a remote reboot to a system that I can't easily get to physically, my main worry tends to be that it might fail to come back up again because of something in the new kernel I might have overlooked, not whether the shutdown or reboot commands will properly execute.

share|improve this answer

Check the Rosetta stone for Unix for ways to perform common administration tasks on various unix variants. When it comes to shutting the system down, most systems provide two commands: one that stops the system services cleanly (going throough a shutdown runlevel, on variants that have runlevels), and one that stops the world and reboots instantly (possibly without even unmounting filesystems cleanly). You should always try the clean variant first, and only use the instant variant if the clean variant failed; if you use the instant variant, first shut down as many things as you can manually.

I believe all the systems you list require proper arguments to shutdown to shut the system down cleanly and reboot. Check the shutdown(8) or shutdown(1m) manual page on each system.

A shutdown can fail only if one of the system services, the kernel or the hardware is buggy. Most OSes will forcibly shut the system down even if some system service fails to stop cleanly. If you have a kernel bug or hardware trouble (such as a misbehaving disk), it's possible for the shutdown process to fail. There isn't much recourse in that case: hardware failures often require physical intervention. A watchdog may help, if you need to reboot the system in case of a hardware failure.

share|improve this answer

As you can read on init man page, the best solution to your specific case is:

 # init 6

Runlevels

A runlevel is a software configuration of the system which allows only a selected group of processes to exist. [...]

Runlevels 0, 1, and 6 are reserved. Runlevel 0 is used to halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to get the system down into single user mode. [...]

For more information on this, see the manpages for shutdown(8) and inittab(5).

share|improve this answer
1  
You're quoting a Linux man page, which says what happens on your system (which has SysVinit) but not what happens on other Linux systems or on non-Linux systems. There are several implementations of init on Linux (SysVinit, Upstart, SystemD); as luck would have it, I believe they all implement init 6 for compatibility with SysVinit. As it happens, init 6 also works on Solaris, but not AFAIK on HP-UX or AIX. –  Gilles Oct 31 '11 at 21:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.