LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-19-2014, 01:00 AM   #1
dlugasx
Member
 
Registered: Dec 2008
Location: Germany/Poland
Distribution: CentOS / Debian / Solaris / RedHat
Posts: 266

Rep: Reputation: 19
What is the difference between "reboot" and "shutdown -r now"


Hi,

does anyone is able to briefly explain me, what is going on when I`m executing

- reboot

and

- shutdown -r now

What is happening in the system then ? Which init is executed by reboot and shutdown command then ?

I would like to fully understand that process.



Cheers

Dlugasx
 
Old 09-19-2014, 10:00 AM   #2
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
From `man reboot` on my machine;
Quote:
If halt or reboot is called when the system is not in runlevel 0 or
6, in other words when it's running normally, shutdown will be
invoked instead (with the -h or -r flag). For more info see the shut‐
down(8) manpage.
Most systems will be in runlevel 3 or 4. When reboot is executed it is mostly calling `shutdown -r`.
http://linux.die.net/man/8/shutdown
http://linux.die.net/man/8/halt (reboot is part of halt)
 
Old 09-19-2014, 10:01 AM   #3
Philip Lacroix
Member
 
Registered: Jun 2012
Distribution: Slackware
Posts: 441

Rep: Reputation: 574Reputation: 574Reputation: 574Reputation: 574Reputation: 574Reputation: 574
The "reboot" command invokes the "shutdown" command with the "-r" option, which in turn switches the system to runlevel 6. If you specify no delay ("-t" option) and add "now" instead, the switch will be performed immediately. Switching to runlevel 6 means that a script (or a set of scripts) will be executed in order to bring down the system properly, by stopping daemons, unmounting filesystems and so on.

Look at your "/etc/inittab" in order to see which script is used for a given runlevel. For instance, on Slackware Linux one will see the following line, which points to tho proper script for runlevel 6:

Code:
# Runlevel 6 reboots the system.
l6:6:wait:/etc/rc.d/rc.6
On other distros based on SysVinit the init directory will be "/etc/init.d/". Because scripts are plain text files, it's fairly easy to see what's happening when switching to a given runlevel. You will find everything in the man pages:

Code:
man reboot
man shutdown
man inittab
 
  


Reply

Tags
reboot, shutdown



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie question: whats the difference between "su root", "su" and "su -&quo mojarron Slackware 9 12-07-2009 04:08 PM
How do I disable "shutdown" and "restart" options in KDE logout screen for all users? maxgsp Linux - Distributions 1 12-12-2008 03:18 PM
"shutdown" and "halt" symlinks: poweroff, reboot. sud_crow Linux From Scratch 11 10-17-2006 11:03 PM
What's the difference between "shutdown -h now" and "halt"? shadkong Slackware 2 04-07-2005 12:43 AM
Removing "shutdown" and "reboot" in logout window nearfar Red Hat 1 10-07-2003 11:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration