LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-28-2010, 01:52 AM   #1
cheng0017
LQ Newbie
 
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
Talking Difference between init 0 and shutdown -h now


Hi everyone,

could anyone enlighten me to see if there are differences between init 0 and shutdown -h now?

Thank you!
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-28-2010, 04:26 AM   #2
unix.fresher
LQ Newbie
 
Registered: Dec 2008
Distribution: redhat
Posts: 27

Rep: Reputation: 17
Dear cheng0017,
shutdown arranges for the system to be brought down in a safe way. All
logged-in users are notified that the system is going down and

init is the parent of all processes on the system, it is executed by the kernel and is responsible for starting all other processes;it is the parent of all processes whose natural parents have died and it is responsible for reaping those when they die.Processes managed by init are known as jobs, and can be further split into two types; services are supervised and respawned if they should terminate unexpectedly, and tasks are simply run once and not respawned if they should terminate.


Basically init 0 change the current run level to run level 0.
shutdown -h can run by any user but init 0 can only run by superuser.
Quote:
[joy@localhost ~]$ init 0
init: Need to be root
[joy@localhost ~]$
 
Old 03-28-2010, 05:35 AM   #3
davcefai
Member
 
Registered: Dec 2004
Location: Malta
Distribution: Debian Sid
Posts: 764

Rep: Reputation: 32
To expand:

From the man page
Quote:
shutdown does its job by sig-
nalling the init process, asking it to change the runlevel. Runlevel 0 is used
to halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is
used to put to system into a state where administrative tasks can be performed
Essentially the end result is the same but shutdown allows useful options which on a multiuser system creates less enemies :-)
 
2 members found this post helpful.
Old 03-28-2010, 01:38 PM   #4
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 36
As far as I know, shutdown command could be run only by root user.

When we run shutdown command it inturn calls the init process to do the job.
Shutdown provides us with more options,
...like for eg.: If your system's name is ServerA, then suppose 3 users are logged in to ServerA remotely via ssh.
Now, you (root) wish to switch off the system, you issue "shutdown -h now" , now all the 3 remote users will be displayed in their working terminal with the message that ServerA is going to shutdown immediately.

Note: I have noticed that in RHEL5, by default, even an ordinary user can execute the command "poweroff" without any problem...? why is it so???

Last edited by saagar; 03-28-2010 at 01:49 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
difference between /etc/init.d and /etc/rc.d/init.d dawn Linux - Newbie 2 10-28-2008 12:02 PM
Difference between /etc/init.d and /etc/rc.d/init.d barkout Linux - Newbie 2 04-02-2007 02:56 PM
init.d difference? yogaboy Linux - General 3 12-18-2006 11:36 AM
difference between /etc/init.d/rc#.d and /etc/rc.d/ zhimsel Linux - General 5 10-26-2006 04:47 PM
Difference between init and others shipon_97 Linux - Newbie 3 03-04-2006 11:12 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration