Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
Just wondering what the difference between halt and shutdown -h now really is? They both lead to the same thing; turn the computer off. But is one preferable to the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Jan 2006
    Posts
    414

    halt vs. shutdown


    Just wondering what the difference between
    halt
    and
    shutdown -h now
    really is? They both lead to the same thing; turn the computer off. But is one preferable to the other, or what is the difference?

    Ta

  2. #2
    Linux User Krendoshazin's Avatar
    Join Date
    Feb 2005
    Location
    London, England
    Posts
    471
    There's not much difference, infact as I remember, halt calls shutdown, as does reboot, it's just simpler to do shutdown: halt, reboot: reboot.

  3. #3
    Linux User DThor's Avatar
    Join Date
    Jan 2006
    Location
    Ca..na...daaa....
    Posts
    319
    Some Grumpy Gus background rambling here, which gives a little background on how halt and reboot have be altered to call shutdown, which really should be the thing that's called in most cases anyway. Shutdown is the gold standard - it gently shuts down processes. Personally, I had a perverse sense of joy typing in "init 0" when I was younger, just because it's so brutish.

    DT

  4. $spacer_open
    $spacer_close
  5. #4
    Linux User
    Join Date
    Jan 2006
    Posts
    414
    Thanks guys, that link was helpfull too.

    I've been working on a little script to allow all users to shutdown the system, and wasn't sure whether it should invoke 'halt' or 'shutdown -h now'

    Have now gone for the latter.

    Would anyone like to try the script? I've run it on my laptop and it worked great.

  6. #5
    Linux Enthusiast
    Join Date
    Jun 2005
    Posts
    668
    If you just configured sudo you wouldnt need the script

    I have sudo entries for user 'kernow' and he can shut down the pc with the normal 'halt' command.

    if you so wanted you could make a group called 'shutdowners' and then add this to /etc/sudoers, then add people you want to be able to shutdown the computer - to the 'shutdowners' group


  7. #6
    Linux User
    Join Date
    Jan 2006
    Posts
    414
    I was going to do something like that, but I haven't written a shell script before and thought this would be a good little exercise.

    The script checks that sudo is installed, downloads and installs it if it's not, changes /etc/sudoers to allow all users to issue the shutdown command, and simplifies the command a little so that just entering 'shutdown' in terminal will execute 'sudo shutdown -h now'.

    I eventually want to make so that it will add a shutdown entry to the Fluxbox menu to enable a 'point and click' shutdown from the GUI.

  8. #7
    Linux Enthusiast
    Join Date
    Jun 2005
    Posts
    668
    I have an entry on my fluxbox menu just for that.

    it just runs 'sudo halt'

  9. #8
    Linux User
    Join Date
    Jan 2006
    Posts
    414
    Yeah that's what i wanna do, I just felt like writting a script to do it.

  10. #9
    Linux Enthusiast
    Join Date
    Jun 2005
    Posts
    668
    Quote Originally Posted by darkrose0510
    The script checks that sudo is installed, downloads and installs it if it's not, changes /etc/sudoers to allow all users to issue the shutdown command, and simplifies the command a little so that just entering 'shutdown' in terminal will execute 'sudo shutdown -h now'.
    but your script just adds the entries to /etc/sudoers anyway, pointless having a script really when you could just add the user(s) to /etc/sudoers manually, then just run 'sudo halt' from the command line or your fluxbox menu.

    if you still wanted to use 'shutdown' instead of 'shutdown -h now' you could just create a BASH alias in ~/.bash_profile

    ah well. it was fun scripting right?

  11. #10
    Linux Engineer
    Join Date
    Apr 2005
    Location
    Buenos Aires, Argentina
    Posts
    908
    poweroff, halt, shutdown, reboot, they're all the same
    serzsite.com.ar
    "All the drugs in this world won\'t save you from yourself"

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •