Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
The ONE Campaign to make poverty history

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents
Up to --> Basic Administration

· Starting and Stopping the System
· The Boot Process
· Run Levels
· Init Scripts
· LILO-The Linux Loader
· Stopping the System

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Recommend Us
Surveys

Features
HOWTOs
News
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 281 guest(s) and 3 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  
Linux Tutorial - Basic Administration - Starting and Stopping the System - Stopping the System
  LILO-The Linux Loader ---- User Accounts  


Stopping the System

For those of you who hadn't noticed, Linux isn't like DOS or Windows. Despite the superficial similarity at the command prompt and similarities in the GUI, they have little in common. One very important difference is the way you stop the system.

In DOS or Windows 95/98/ME, you are completely omnipotent. You know everything that's going on. You have complete control over everything. If you decide that you've had enough and flip the power switch, you are the only one doing so will effect. However, with dozens of people working on an Linux system and dozens more using its resources, simply turning off the machine is not something you want to do. Despite the fact that you will annoy quite a few people, it can cause damage to your system, depending on exactly what was happening when you killed the power. (Okay, you could also create problems with a DOS system, but with only one person, the chances are less likely).

On a multi-user system like Linux, many different things are going on. You many not see any disk activity, but the system may still have things its buffers which are waiting for the chance to write to the hard disk. If you turn off the power before this data is written, what is on the hard disk may be inconsistent.

Normally, pressing Ctrl-Alt-Del will reboot your system. You can prevent this by creating the file /etc/shutdown.allow, which contains a list (one entry per line) of users. If this file exists, the system will first check whether one of the users listed in shutdown.allow is logged in on the system console. If none are, you see the message

shutdown: no authorized users logged in.

To make sure that things are stopped safely, you need to shut down your system "properly." What is considered proper can be a couple of things, depending on the circumstances. Linux provides several tools to stop the system and allows you to decide what is proper for your particular circumstance. Flipping the power switch is not shutting down properly.

Note that the key combination Ctrl-Alt-Del is just a convention. There is nothing magic about that key combination, other than people are used to it from DOS/Windows. By default, the combination Ctrl-Alt-Del is assigned to the special keymap "Boot". This is typically defined by default in the file /usr/src/linux/drivers/char/defkeymap.map, which is the keyboard mapping the kernel uses when it boots. However, you can use the loadkeys program to change this if you need to.

If necessary, you could define that the combination Ctrl-Alt-Del is not assigned to anything, therefore it would not shutdown your system. However, should the system get stuck in a state that you cannot correct, shutting it down with Ctrl-Alt-Del is often the only safe alternative (as compared with simply flipping the power switch.)

When you press the "boot" key combination, the init program is sent the signal SIGINT. What init does will depend on how the /etc/inittab is configured. In the section on run levels, we talked about the various actions in /etc/inittab that tell init what to do when the key combination Ctrl-Alt-Del is pressed (one being ctraltdel). On my system it is defined as "/sbin/shutdown -r -t 4 now", which says to run the shutdown command immediately (now) and reboot (-r), waiting four seconds between the time the warning message is sent and the shutdown procedure is started (-t 4).

The first two tools to stop your system are actually two links in /sbin: halt and reboot, that link to the same file. If either of these is called and the system is not in run-level 0 or 6, then shutdown (also in /sbin) is called instead.

Running shutdown is really the safest way of bringing your system down, although you could get away with running init 0. This would bring the system down, but would not give the users any warning. Shutdown can be configured to give the users enough time to stop what they are working on and save all of their data.

Using the shutdown command, you have the ability not only to warn your users that the system is going down but also to give them the chance to finish up what they were doing. For example, if you were going to halt the system in 30 minutes to do maintenance, the command might look like this:

shutdown -h +30 "System going down for maintenance. Back up after lunch."

This message will appear on everyone's screen immediately, then at increasing intervals, until the system finally goes down.

If you have rebuilt your kernel or made other changes that require you to reboot your system, you can use shutdown as well, by using the -r option.

Option Description
-d Do not write to the /var/log/wtmp.
-f Force a reboot, i.e. do not call shutdown.
-i Shutdown the network interfaces before halting or rebooting.
-n Do not sync (write data to disk) before halting or rebooting.
-p Power off after shutdown.
-w Do not actually stop the system, just write to /var/log/wmtp.

Table - Options to halt and reboot.

Option Description
-c Cancel a shutdown that is in progress.
-f Don't run fsck when the system reboots (i.e. a "fast" reboot).
-F Force fsck on reboot.
-h Halt the system when the shutdown is completed.
-k Send a warning message, but do not actually shutdown the system.
-n Shutdown without calling init. DEPRECATED.
-r Reboot the system after shutdown.
-t seconds Seconds to wait before starting the shutdown.
-z Shutdown using "software suspend".

Table - Options to shutdown.

 Previous Page
LILO-The Linux Loader
  Back to Top
Table of Contents
Next Page 
User Accounts


MoreInfo

Test Your Knowledge

User Comments:


You can only add comments if you are logged in.

Copyright 2002-2009 by James Mohr. Licensed under modified GNU Free Documentation License (Portions of this material originally published by Prentice Hall, Pearson Education, Inc). See here for details. All rights reserved.
  




Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
The Linux Tutorial welcomes your suggestions and ideas.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.11 Seconds