As mentioned briefly in the comments section of Bootstrapping your Linux Machine, recent Linux systems have added a convenience feature to the 'halt' and 'reboot' commands: they actually call 'shutdown' if the system isn't in init state 0 or 6.
You can override this behaviour with "-f" or use 'poweroff', but I'm not entirely sure that this was a good idea to start with.
The purpose of 'shutdown' is to bring the system down cleanly. It should kill off user processes gently (starting with SIGTERM so that processes that trap that can clean up open files, etc.) and it should then have 'init' change run levels so that appropriate scripts can run to do other cleanup.
This is all to the good. It's the way a system should be brought down under normal circumstances, so having 'halt' and 'reboot' invoke 'shutdown' is certainly helpful for the naive user who doesn't understand what should be done to bring down a system. But should traditional commands be perverted to prevent naive users from damaging systems?
Maybe. Unfortunately people were probably using 'halt' and 'reboot' before that change was made, and few of them probably read the man pages to understand what they really did. But I have to say that it bothers me: pandering to ignorance doesn't seem right. Maybe a shell function that warned "You probably want shutdown; shall I run that instead?" would have been a better idea - leave the commands as we cranky old folks expect them to be and educate the newbies. That seems like a better path to me. Even better might have been to build the warning into 'consolehelper' (read the man page if you don't know what this is).
The perversion of halt also originally led to the "poweroff" problem described at Power off and kernels version 2.1.xx and 2.2.xx. At that time, you couldn't use 'halt -p' because the '-p' (poweroff) option would get lost on the way through 'shutdown'. That problem doesn't exit on my RedHat system: 'halt -p' properly powers off, but the article still shows the kind of things that can happen when someone decides (probably correctly, unfortunately) that they should protect users from their own lack of knowledge.
Incidentally, Mac OS X keeps a more traditional halt. It kills processes, and syncs discs. If invoked with -q it doesn't kill processes, and if you give it -n it doesn't sync either. Now that's a halt that does what it is told! SCO OSR5 doesn't have halt; they have 'haltsys', which only syncs and actually just calls a more general purpose uadmin.
Overall, it's a tough call. New and improved sometimes is better, sometimes isn't, and sometimes I just can't make up my mind. This certainly is one of those cases.
More Articles by Anthony Lawrence - Find me on Google+
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar