Page 1 of 1

Explanation of startup system/scripts needed.

Posted: Sun Dec 28, 2003 9:22 pm
by stoke
So I think I understand /etc/runlevels. By adding scripts in here, they load off the startup scripts found in /etc/init.d/

But how does /etc/conf.d/ play into that?

But then, what do all the hidden files in the home directories do? like .vncstart. Does this get called automatically or does another file run it? How do I add more things to load when X starts up? Add them to .xinitrc? What calls on this file to run?

Any brief explanation of all of this would be great.

Posted: Sun Dec 28, 2003 9:34 pm
by stoke
One of my major confusions is /etc/conf.d/local.start

Why is this file needed when you can use /etc/runlevels/?

I'm having the harded time getting vnc to load at startup. (I fucked with it when I couldn't connect a while ago and now it's not loading anymore at all)

Posted: Mon Dec 29, 2003 2:27 pm
by chro
Ok, I'll try and explain this a bit. :P

Runlevels are simply different modes the system runs at. There is actually no different from the different runlevels, except that each level calls a different script. Traditionally, you would have a directory for each runlevel in a directory such as: /etc/rc.d/init.X where X is the runlevel number.

The /etc/init.d is symbollically linked to the current runlevel when the level changes.

With the Gentoox port, this is not the case. There is a /etc/init.d directory, which is a normal directory, not a symbolic link. It has all the startup scripts. All these are are shell scripts that take a few parameters: start, stop, restart and maybe status. When the runlevel enters, the start parameter is passed, when it's exited, the stop parameter is passed.

At this point, you might be wondering how these scripts are invoked... well, with the runlevel linking, when a runlevel is entered, the mapping is made to /etc/init.d and each script is ran with the start command. The order of precedence is set from another location where, you guessed it, more symbolic links have been set. For instance, /etc/rc.d/init.d/sshd.3 could mean that the ssh daemon will load after any items with a .0 through .2.

With Gentoox, the scripts are invoked from the /etc/runlevel/boot and /etc/runlevel/default directorys. All that's in there are the symbolic links to the /etc/init.d scripts. If you haven't figured it out yet, alot of the Linux functionallity is done via linking. It makes it alot cleaner. You can see this behavior almost everywhere. Look in the /usr/lib directory. You'll typically see something like:

Code: Select all

Pro lib # ls -la libcrypto.*
-rw-r--r-- root     root        14 Jan  1 12:00 libcrypto.so -> libcrypto.so.0
lrwxrwxrwx root     root        14 Jan  1 12:00 libcrypto.so.0 -> libcrypto.so.9.6
lrwxrwxrwx root     root    911444 Jan  1 12:00 libcrypto.so.9.6
This allows a program to link to the libcrypto.so library without having to know what version is installed, or it can link to a specific library if it needs a specific version. It also allows you to have multiple versions of a library, which helps eliminate the "dllhell" syndrome that windows suffers from.

The /etc/conf.f directory contains all the configuration files for the system daemons and whatnot. If you look at, say, the /etc/conf.d/net file:

Code: Select all

Pro root # cat /etc/conf.d/net
# /etc/conf.d/net:
<lots of lines of stuff>
iface_eth0="dhcp"
<and so on and so force>
You see all the configurations for that type of daemon or service. The startup scripts in the /etc/init.d will parse these out and use them to do whatever they need. The network script will take this information and bring up the modules for the network card whereas the xbv script will setup your screen based on the data in these files.

As for the "hidden" .vncstart or .xinitrc files, these are configuration files. By the "unwritten rule standard," any file beginning with a . (period) will be considered hidden. It will not show up in a normal directory listing or file manager, unless otherwise told to. ex: "ls -la" will do a directory list in detailed format and show all the files in the directory, including hidden, devices and symbolic link locations.

These files are created by individual applications and contain nothing more then preferences. The .xinitrc contains a list of commands the X server will do after it starts. You can put all the programs you want to open by default in there and it'll auto launch them when you start X. Another use will have her own .xinitrc, hence why it's in your home directory.

I think that about covers it, but if you need any more information, or clarification, or want to complain about my rant/post/whatever, feel free to ask and/or complain. :D

-chro

Posted: Mon Dec 29, 2003 6:07 pm
by stoke
Thanks, that actually helps a lot.