1834772 Members
3153 Online
110070 Solutions
New Discussion

QUESTION

 
SOLVED
Go to solution
Nobody's Hero
Valued Contributor

QUESTION

Is there any difference between the following two commands?

"reboot -q"
"shutdown -r -y 0"

Thanks,
UNIX IS GOOD
11 REPLIES 11
Frederic Sevestre
Honored Contributor
Solution

Re: QUESTION

Hi,

shutdown is the clean way to stop your server. Indeed then sthtdown run all the rc's script and stop propelly all process running.
The "reboot -q" does nothing, it is like a crash.

Fr??d??ric
Crime doesn't pay...does that mean that my job is a crime ?
Sebastian Galeski_1
Trusted Contributor

Re: QUESTION

Both /etc/shutdown and /etc/reboot can be used to either halt or reboot
your system. Which command to use depends upon several factors, including
how many users are on the system, how quickly you need to shut down the
system and what run-level the system is operating in.

"shutdown" is generally used when the system is in a multi-user state
such as run-level 2. It uses "kill -15" to terminate running processes,
which allows them to terminate naturally within a grace period (default
of 60 seconds), ensuring the integrity of the file system.

"shutdown" also performs these tasks:

* changes the current working directory to /
* updates all superblocks
* shuts down the accounting subsystem
* halts all daemon processes
* writes the contents of all I/O buffers to disk
* unmounts all file systems

Finally, the system is put into single-user mode (run-level s) and
/etc/reboot is called if applicable.

"shutdown" allows the superuser to warn all users currently logged into
the system, that it will be shut down and the superuser can specify a
grace period for users to log out, before the shut down process
commences.

The system administrator has the ability to customise the shut down
procedure through the use of user-supplied scripts placed in the
/etc/shutdown.d directory. This exists for users who have specialised
shutdown procedure requirements, such as shutting down databases prior
to the system shutting down.

One further functionality associated with the "shutdown" command is the
ability of the system administrator to authorise certain users to
execute "shutdown". This is done by editing the /etc/shutdown.allow
file accordingly. However, even though other users may be privileged to
use "shutdown" to halt or reboot the system, only the superuser may put
the system into single-user mode.

"reboot" is generally used to reboot or halt the system once in
single-user mode. It's default action is to "sync" all disks and then
reboot the system.

To terminate currently running processes, it uses "kill -9" which
terminates them immediately. This is dangerous, as processes are not
allowed to terminate naturally and it may have undesirable
repercussions, such as loss of data.

As all processes are terminated without a grace period, "reboot" is
faster than "shutdown" and, therefore, may be used when the system
administrator needs to bring the system down very quickly.

"reboot" also allows the superuser to specify a certain time to halt or
reboot the system, and to send a message to users currently logged on,
to inform them of the system's impending halt or reboot.

For a full explanation of "shutdown" and "reboot", refer to the manual
pages for shutdown(1m) and reboot(1m), respectively.
Pete Randall
Outstanding Contributor

Re: QUESTION

Robert,

From man 1m reboot -q option:
Quick and quiet. Suppress broadcast of warning
messages, terminate processes by brute force (with
SIGKILL) and immediately call reboot with
arguments as indicated by the other options

Shutdown does an orderly shutdown, going through all the kill scripts and terminating everything gracefully.

HTH,
Pete

Pete
Steve Steel
Honored Contributor

Re: QUESTION

Hi

yes

reboot -q


-q Quick and quiet. Suppress broadcast of warning messages, terminate processes by brute force (with SIGKILL) and immediately call reboot with
arguments as indicated by the other options (see reboot(2)). No logging is performed. The -t and -m options are ignored with this option.

shutdown -r -y 0

-r Shut down the system and reboot automatically.

-y Do not require any interactive responses from the user.
(Respond yes or no as appropriate to all questions, such that the user does not interact with the shutdown process.)

0 is do not wait.

The -q kills of processes and the shutdown does a proper reboot closing everything down
neatly


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Sachin Patel
Honored Contributor

Re: QUESTION

Hi robert,
reboot with -q will do this

Suppress broadcast of warning messages, terminate processes by force and reboot the systems.

Shutdown with -r will also reboot the system but it will gracefull kill all process.

Sachin
Is photography a hobby or another way to spend $
Paula J Frazer-Campbell
Honored Contributor

Re: QUESTION

ANSWER

Yes

"reboot -q"
"shutdown -r -y 0"

Basiclly:-

Reboot is called from shutdown after it elegantly tidies up.

HTH

Paula

If you can spell SysAdmin then you is one - anon
Helen French
Honored Contributor

Re: QUESTION

YES !

reboot -q : Is a quick and quiet reboot. Will immediately call the reboot function. This will not shutdown all processes in a proper manner. This will not run the stop rc scripts.

shutdown -y -r 0 : This will shutdown and restart the server in a proper manner. Good method if you want a remote system to restart. This will run all rc stop scripts, so that all running processes will be killed in a proper manner.
Life is a promise, fulfill it!
PIYUSH D. PATEL
Honored Contributor

Re: QUESTION

Hi,

Shutdown runs all the Stop scripts and stops all the daemons gracefully and properly. Then it halts the system

Reboot doesn not run the Stop scripts ( just kill the daemons ) and stops the servers.

There lies the main difference. After you give a reboot command, your system may not come up gracefully and you may have to run fsck on the filesystems also.

Piyush
Paula J Frazer-Campbell
Honored Contributor

Re: QUESTION

8 answers in 3 min is this a record.

If you can spell SysAdmin then you is one - anon
S.K. Chan
Honored Contributor

Re: QUESTION

Yes definately ..
Reboot
======
- Does not terminate all process in a graceful manner when run in a multi-user mode, hence it is faster than shutdown but can potentially cause problem (eg: data corruption)
- Usually used to halt the system which is already in single-user mode as it will to synchronized all disks before rebooting the system.

Shutdown
========
- When run from multi-user mode it uses
"kill -15" to terminate processes hence allow cleaner termination. File system is properly shutdown.
- Take longer than "reboot because it does this ..
a) Updates all superblocks
b) Halts all daemon processes
c) Writes contents of all I/O buffers to disk.
d) Umount all FS.

MANOJ SRIVASTAVA
Honored Contributor

Re: QUESTION

Hi Robert


You amy also like to look into thsi thread :


http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x4f701cc6003bd6118fff0090279cd0f9,00.html


Manoj Srivastava