|
Home | Switchboard | Unix Administration | Red Hat | TCP/IP Networks | Neoliberalism | Toxic Managers |
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix |
News | Recommended Links |
Open Boot | Solaris Run Levels | SMF | Startup Files |
Serial Console on Solaris | ALOM | Boot Process | History | Humor | Etc |
|
You can shut down the system in a number of ways, using various Unix commands. With Solaris, taking down the operating system in an orderly fashion is important. When the system boots, several processes are started; they must be shut down before you power off the system. In addition, information that has been cached in memory and has not yet been written to disk will be lost if it is not flushed from memory and saved to disk. The process of shutting down Solaris involves shutting down processes, flushing data from memory to the disk, and unmounting file systems.
|
Commands Using init and using shutdown are the most reliable ways to shut down a system because these commands use rc scripts to kill running processes and shut down the system with minimal data loss.
NOTES
Protecting Against Power Loss To avoid having your system shut down improperly during a power failure, you should use an uninterruptible power supply (UPS) that is capable of shutting down the system cleanly before the power is shut off. Be sure to follow the UPS manufacturer's recommendations for maintenance to eliminate the risk of the UPS becoming the cause of an improper shutdown.
When you're preparing to shut down a system, you need to determine which of the following commands is appropriate for the system and the task at hand:
The first three commands—/usr/sbin/shutdown, /sbin/init, and /usr/sbin/halt—initiate shutdown procedures, kill all running processes, write data to disk, and shut down the system software to the appropriate run level. The /usr/sbin/reboot command does all these tasks as well, and it then boots the system back to the state defined as initdefault in /etc/inittab. The /usr/sbin/poweroff command is equivalent to init state 5. The last command, which is really a series of keystrokes, stops the system unconditionally.
CAUTION
Aborting the Operating System Using the Stop+A key sequence (or L1+A) abruptly breaks execution of the operating system and should be used only as a last resort to restart the system.
You use the shutdown command to shut down a system that has multiple users. The shutdown command sends a warning message to all users who are logged in, waits for 60 seconds (by default), and then shuts down the system to single-user state. The command option -g lets you choose a different default wait time. The -i option lets you define the init state to which the system will be shut down. The default is S.
NOTE
Sending a Shutdown Message When using either shutdown or init, you might want to give users advance notice by sending an email message about any scheduled system shutdown.
The shutdown command performs a clean system shutdown, which means that all system processes and services are terminated normally, and file systems are synchronized. You need superuser privileges to use the shutdown command.
When the shutdown command is initiated, all logged-in users and all systems mounting resources receive a warning about the impending shutdown, and then they get a final message. For this reason, the shutdown command is recommended over the init command on a server with multiple users.
The proper sequence of shutting down the system is described in Step by Step 3.3
# who
# shutdown -i<init-state> -g<grace-period> -y
Option | Description |
-i<init-state> | Brings the system to an init state that is different from the default, S. The choices are 0, S, 1, 2, 5, and 6. |
-g<grace-period> | Indicates a time (in seconds) before the system is shut down. The default is 60 seconds. |
-y | Continues to shut down the system without intervention; otherwise, you are prompted to continue the shutdown process after 60 seconds. If you use the shutdown -y command, you are not prompted to continue; otherwise, you get the message Do you want to continue? (y or n). |
You use the init command to shut down a single-user system or to change its run level. The syntax is as follows:
init <run-level>
<run-level> is any run level described in Table 3.21. In addition, <run-level> can be a, b, or c, which tells the system to process only /etc/inittab entries that have the a, b, or c run level set. These are pseudo-states, which can be defined to run certain commands but which do not cause the current run level to change. <run-level> can also be the keyword Q or q, which tells the system to reexamine the /etc/inittab file.
You can use init to place the system in power-down state (init state 0) or in single-user state (init state 1). For example, to bring the system down to run level 1 from the current run level, you type the following:
init 1
NOTE
The telinit Command The telinit command is the same as the init command. It is simply a link to the /usr/sbin/init command.
The system responds with this:
INIT: New run level: 1 Changing to state 1. Unmounting remote filesystems: /vol nfs done. System services are now being stopped. Mar 14 13:13:22 unknown /usr/sbin/vold[475]: problem unmounting /vol; Interrupted system call Mar 14 13:13:22 unknown pseudo: pseudo-device: tod0 Mar 14 13:13:22 unknown genunix: tod0 is /pseudo/tod@0 Mar 14 13:13:22 unknown pseudo: pseudo-device: pm0 Mar 14 13:13:22 unknown genunix: pm0 is /pseudo/pm@0 Print services stopped. Mar 14 13:13:22 unknown syslogd: going down on signal 15 Killing user processes: done. Change to state 1 has been completed. Type control-d to proceed with normal startup, (or give root password for system maintenance):
As another example, say you made a change to the /etc/inittab file and you want to have the system reread /etc/inittab and implement the change. In this case, you type the following:
init q
No system messages are displayed, and the inittab file is reexamined.
You use the halt command when the system must be stopped immediately and it is acceptable not to warn current users. The halt command shuts down the system without delay and does not warn other users on the system of the shutdown.
You use the reboot command to shut down a single-user system and bring it into multiuser state. reboot does not warn other users on the system of the shutdown.
The Solaris reboot and halt commands perform unconditional shutdown of system processes. These commands shut down the system much more quickly than the shutdown command, but they do not do so as gracefully because they do not run the kill scripts located in /etc/rc<n>.d. No messages are sent to users; although reboot and halt do not notify all logged-in users and systems mounting resources of the impending shutdown, they do synchronize file systems.
The speed of such a reboot is useful in certain circumstances, such as when you're rebooting from the single-user run state. Also, the capability to pass arguments to OpenBoot via the reboot command is useful. For example, this command reboots the system into run level s and reconfigures the device tables:
reboot -- -rs
The poweroff command is equivalent to the init 5 command. The poweroff command immediately shuts down the system, without running rc0 kill scripts. Users are not notified of the shutdown. If the hardware supports it, the poweroff command also turns off power.
NOTE
The init and shutdown Commands Using init and using shutdown are the most reliable ways to shut down a system because these commands use rc scripts to kill running processes and shut down the system with minimal data loss.
The halt, poweroff, and reboot commands do not run the rc scripts properly and are not the preferred method of shutting down the system.
Occasionally, a system might not respond to the init commands described earlier in this chapter. A system that doesn't respond to anything, including reboot or halt, is called a "crashed" or "hung" system. If you try to use the commands discussed in the preceding sections but get no response, you can press Stop+A or L1+A to get back to the boot PROM. (The specific Stop key sequence depends on your keyboard type.) On terminals connected to the serial port, you can press the Break key, as described in the section "Accessing the OpenBoot Environment," earlier in this chapter.
Some OpenBoot systems provide the capability of commanding OpenBoot by means of pressing a combination of keys on the system's keyboard, referred to as a keyboard chord or key combination. These keyboard chords are described in Table 3.26. When issuing any of these commands, you press the keys immediately after turning on the power to your system, and you hold down the keys for a few seconds until the keyboard light-emitting diodes (LEDs) flash.
Command | Description |
Stop | Bypasses the POST. This command does not depend on the security mode. (Note that some systems bypass the POST as a default; in such cases, you use Stop+D to start the POST.) |
Stop+A | Interrupts any program currently running and puts the system at the OpenBoot prompt, ready to accept OpenBoot PROM commands. |
Stop+D | Enters diagnostic mode (sets the diag-switch? variable to true). |
Stop+F | Enters Forth on the ttya port instead of probing. Uses fexit to continue with the initialization sequence. This chord is useful if hardware is broken. |
Stop+N | Resets the contents of NVRAM to the default values. |
To change the default abort sequence on the keyboard, you need to edit the /etc/default/kbd file. In that file, you can enable and disable keyboard abort sequences, and change the keyboard abort sequence. After modifying this file, you issue the kbd –i command to update the keyboard defaults.
NOTE
Disabling Keyboard Chords The commands in Table 3.26 are disabled if PROM security is on. Also, if your system has full security enabled, you cannot apply any of these commands unless you have the password to get to the ok prompt.
The process of breaking out of a hung system is described in Step by Step 3.4.
TIP
Interrupting a Hung System Step by Step 3.4 describes an objective that is sure to be on the exam. Make sure that you understand each step and the order in which the steps are executed.
The monitor displays the ok PROM prompt.
ok sync
The sync procedure synchronizes the file systems and is necessary to prevent corruption to the file system.
ok reset
# who –r
run-level 3 Jun 9 09:19 3 0 S
Society
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
Quotes
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
Classic books:
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|
You can use PayPal to to buy a cup of coffee for authors of this site |
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.
Last modified: March 12, 2019