LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 04-03-2011, 10:01 AM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Rep: Reputation: 51
shutdown and halt


hi

I can shutdown my debian using shutdown or halt.
What is the exact difference between shutdown and halt?

Last edited by cccc; 04-10-2011 at 06:11 PM.
 
Old 04-03-2011, 10:40 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
The 'man' command provides documentation on various commands. From 'man halt':

Quote:
When called with --force or when in runlevel 0 or 6, this tool invokes the reboot(2) system call itself and directly reboots the system. Otherwise this simply invokes the shutdown(8) tool with the appropriate arguments.
 
Old 04-10-2011, 06:52 PM   #3
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
According to squeeze man pages:

Code:
shutdown - bring the system down

shutdown brings the system down in a secure way.  All logged-in users
are notified that the system is going down, and  login(1)  is  blocked.
It is possible to shut the system down immediately or after a specified
delay.  All processes are first notified that the system is going  down
by the signal SIGTERM.  This gives programs like vi(1) the time to save
the file being edited, mail and news processing programs  a  chance  to
exit  cleanly,  etc.   shutdown  does  its  job  by signalling 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; this is the default if neither the -h or -r flag is given to
shutdown.  To see which actions are taken on halt  or  reboot  see  the
appropriate entries for these runlevels in the file /etc/inittab.

/sbin/shutdown [-akrhPHfFnc] [-t sec] time [warning message]
Code:
halt, reboot, poweroff - stop the system.

Halt  notes  that  the  system  is  being  brought  down  in  the  file
/var/log/wtmp, and then either tells the  kernel  to  halt,  reboot  or
power-off the system.

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 shutdown(8)
manpage.

The rest of this manpage describes the behaviour in runlevels 0 and  6,
that is when the systems shutdown scripts are being run.


/sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] [-h]
/sbin/reboot [-n] [-w] [-d] [-f] [-i]
/sbin/poweroff [-n] [-w] [-d] [-f] [-i] [-h]
It seems to be not so much difference between shutdown and halt command.
 
Old 04-10-2011, 09:01 PM   #4
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Oh yes it is... It's like driving behind a truck that has or doesn't have working brake lights...
 
Old 04-10-2011, 09:45 PM   #5
vtel57
Senior Member
 
Registered: Jul 2006
Location: USA
Distribution: Slackware64 - 14.2 w/ Xfce
Posts: 1,631

Rep: Reputation: 489Reputation: 489Reputation: 489Reputation: 489Reputation: 489
Shutdown allows for a time factor and a warning message to other users on the system. Halt is LIGHTS OUT with no warning.

If you're the only user on your system, either will be fine. You must be root to execute these commands, though. You can also use telinit 0, which tells the system to go into run level 0 (halt, off, power down).

Have FUN!

Last edited by vtel57; 04-10-2011 at 09:47 PM.
 
  


Reply



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 halt , shutdown and poweroff csegau Linux - Newbie 3 08-25-2010 08:56 AM
laptop halt instead of shutdown kafnir Linux - Laptop and Netbook 2 12-01-2007 05:25 PM
shutdown/Halt system from /etc/rc ladio Linux - General 2 09-22-2007 06:12 PM
unable to 'shutdown' from x... need to shutdown using 'halt' guitarnix Linux - Newbie 5 11-24-2003 01:00 AM
halt, shutdown, and reboot HappyDude Linux - Software 29 07-24-2003 02:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:59 AM.

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