LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-31-2005, 03:45 AM   #1
zerog
LQ Newbie
 
Registered: Sep 2003
Distribution: rh9/mdk9
Posts: 18

Rep: Reputation: 0

nevermind.

Last edited by zerog; 12-31-2005 at 08:50 AM.
 
Old 12-31-2005, 09:15 PM   #2
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
Quote:
Originally Posted by zerog
nevermind.
Please don't do this - it's pretty much creates litter in the forums. Rather than delete your original post, please just post a simple followup that indicates what the solution was. Thanks. Please keep in mind that other future readers may run into the same situation, and your post might help them out
 
Old 01-02-2006, 10:11 PM   #3
zerog
LQ Newbie
 
Registered: Sep 2003
Distribution: rh9/mdk9
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by J.W.
Please don't do this - it's pretty much creates litter in the forums. Rather than delete your original post, please just post a simple followup that indicates what the solution was. Thanks. Please keep in mind that other future readers may run into the same situation, and your post might help them out
I understand, but I thought that I could delete the entire thread.

My "solution", which was basically pieced together from a lot of incomplete explanations - all the startup/shutdown scripts are in /etc/rc.d and everything else is a shortcut. Each of the runlevel directories is actually a list specifying the order in which to run the scripts. Stop scripts run before start. (S00)killall is the main shutdown so you can comment things out there. I still don't know how to create a startupscript so I have just copied the simplest one I can find and replaced the things I do understand. Some configuring in the BIOS and now I can (finally) short my motherboard and the machine will boot, and later, shut down, without needing any keys pressed.
 
Old 01-03-2006, 11:43 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
Yes... that's a perfectly valid question, and one that would be of interest to other people.

Here's the skinny...

(1) To quote man init:
Quote:
A runlevel is a software configuration of the system which allows only a selected group of processes to exist. The processes spawned by init for each of these runlevels are defined in the /etc/inittab file. init can be in one of eight runlevels: 0?6 and S or s. The runlevel is changed by having a privileged user run telinit, which sends appropriate signals to init, telling it which runlevel to change to.

Runlevels 0, 1, and 6 are reserved. Runlevel 0 is used to halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to get the system down into single user mode. Runlevel S is not really meant to be used directly, but more for the scripts that are executed when entering runlevel 1. For more information on this, see the man-pages for shutdown(8) and inittab(5).

Runlevels 7-9 are also valid, though not really documented. This is because "traditional" Unix variants don't use them. In case you?re curious, runlevels S and s are in fact the same. Internally they are aliases for the same runlevel.
So, the system "shuts down" by "switching to runlevel 0." It starts-up by switching to the default runlevel specified in /etc/inittab, usually "5."

(Incidentally, Windows has this concept too ... "safe mode" is a runlevel.)

(2) If we look at /etc/inittab, we see that it executes the /etc/rc.d/rc script with a single parameter that specifies the runlevel.

(3) If we look at that script (there are no secrets in Linux...), we see that it searches for files in /etc/rc.d/rcn.d, where n is the chosen runlevel, looking first for files that start with "K"(ill) , then for files that start with "S"(tart). It executes these files with a parameter of "stop" or "start," respectively, and it processes the files in ascending alphabetic order.

(4) Pressing the point further, if we look in any one of the /etc/rc.d/rcn.d directories, we see files like, say, "S55cups" or "K87irqbalance." They start with either "S" or "K", as expected, and the two digits clearly must be intended to place them in a predictable "alphabetic order." We also observe, if we do ls -l, that each of these files are in fact a symbolic link (symlinks) ... a reference to a file that actually exists somewhere else.

(5) That "somewhere else" is /etc/init.d and here we find all of the scripts. A script may be "pointed to" by many different symlinks in these various directories.

This, then, explains what most of the messages that we see at startup time actually come from. When we see "starting cups [ok]" ...
  • init is "switching to" runlevel 5.
  • The /etc/inittab file has told it to run rc 5.
  • The rc script is trolling through the "Snn..." symlinks one by one, calling each one by means of its action subroutine (/etc/init.d/functions), which will check the return value and print either "[ok]" or "[FAILED]."
  • The /etc/init.d/cups start command apparently returned an "okay" return-code.

Last edited by sundialsvcs; 01-03-2006 at 11:45 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
linux shutdown procedure ganesan16 Linux - General 1 11-10-2005 09:11 AM
live cd procedure sailu_mvn Linux - Software 3 08-17-2005 02:00 AM
Function or procedure? linuxanswer Programming 1 10-28-2003 03:13 PM
Installation Procedure? usman767 Linux - Software 2 06-14-2003 07:28 AM
Delegating the 'Shutdown' procedure jingski Linux - General 0 04-17-2001 02:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration