(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Kerio Reseller
Printer Friendly Version

Should 'halt' call 'shutdown'?

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.


Hate these ads?

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.







Technorati tags:

Comments /Linux/halt_shutdown_reboot.html


Add your comments
cartoon
Forget the expense of flying to New England. Forget hotel and meals costs.
Installation and light training Boston and New England


Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


ad

Views for this page
Today This Week This Month This Year  Overall
33591,174 3,816

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.

Publishing your articles here

pavatar.jpg
More:
       - Linux
       - Unix
       - Opinion




Unix/Linux Consultants

Your ad here - $24.00 yearly!

http://thatitguy.com Business networking servers, Linux and Unix experts. In business since 1997! Windows and Exchange to Samba and Scalix migration experts.


http://www.breakthru.com.au SCO (Openserver and Unixware), Unix, Solaris and Linux Consulting services including: Secure Networking Solutions; Linux based Firewalls; Backup Solutions; Secure Home to Office Network Setup; Phone, Remote and On-Site Support available - Satisfaction Guaranteed!


http://www.m3ipinc.com Security, firewalls, ids, audits, vulnerability assesments, BS7799, HIPAA, GLB, incident handling







Coming Attractions

My Favorites

Change Congress


Related Posts