[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Start up?



Joshua Kruck wrote:

hello,
Is there come kind of script that run when the machine boots that i can
put commands into? I want to run sound on when the machine boots, i
would also like to mount some samba commands. Can someone point me to an
easy way to do this?
Thanks
Joshua




Wow; this is a very broad question, and could have 30 or 40 answers to it. You may have to give us more info about what you mean by "run sound on" and if your samba mounts are to be for all users or just a specific user.

Hoping this might help, here's a brief description of the Debian boot process:

(1) The computer's BIOS runs through it's POST (PowerOnSelfTest), and then looks for some boot code in various places (floppy, hard drive, bootable CD, etc).

(2) Once the boot code is found, it may offer a choice of OSes (lilo --> Linux or Windows, etc) or it may just go into its designated OS.

(3) Assuming it's booting Linux, it finds the kernel file (usually vmlinuz, usually, in the /boot dir, with a link in the / dir pointing to it). The kernel does its thing, including finding hardware that it knows about. It does not find module-loaded hardware yet; this is why important stuff, like drivers for scsi drives containing the / partition need to be compiled into the kernel, else the kernel can't find the / partition until it loads the modules, which is on the / partition, which means "uh-oh!").

(4) Once the kernel is finished loading, it runs "/sbin/init", which uses "/etc/inittab" as its configuration file. "/etc/inittab" does some defining of what runlevel is what, and which is the default runlevel (2 for Debian), and starts some gettys (login processes on virtual terms 1 - 6), and decides what will happen when Ctrl-Alt-Delete is pressed, and etc.

(5) "/etc/inittab" tells "init" to execute the command "si::sysinit:/etc/init.d/rcS" to do system initialization things. This runs the script "rcS" in the "/etc/init.d" dir. This script, will in turn, run the scripts in the "/etc/rcS.d" dir. The scripts in this "/etc/rcS.d" directory will run in numerical order. Scripts starting with K will kill services/processes/programs/etc; scripts starting with S will start the same. For example. on my computer, the script "S40hostname.sh" will set the computer's hostname based on the configuration file "/etc/hostname". Also, "/etc/rcS.d/S20modutils" (on my machine) causes the modules listed in "/etc/modules" to be loaded; so if you're just trying to load a sound module, stick the name of the module in "/etc/module" and it should start automatically on bootup. (Actually, the actual scripts are in "/etc/init.d"; the contents of "/etc/rcS.d" and "/etc/rc2.d", etc are just symlinks to the actual scripts.)

(6) Once all the scripts in "/etc/rcS.d" are run, "/etc/inittab" then falls through and tells "/sbin/init" to run "l2:2:wait:/etc/init.d/rc 2" (since runlevel 2 is the default). This causes the scripts in "/etc/rc2.d" to be run, again in numerical order, running the K scripts first, then the S scripts. (You may not have any K scripts in these dirs so far mentioned.)

(7) After these scripts are run, "/etc/inittab" then directs "/sbin/init" to start a getty on each of tty1-6. This provides the login prompt. (If a session manager, such as wdm or gdm is installed, one of the last scripts to be run in the previous step will be to start the session manager, which then gives you a graphical login.)

(8) A user logs in. The user's personal startup scripts (".bashrc" and ".bash_profile" in the user's home dir) are then run. If the samba mounts you refer to are for a single user, one of these personal startup scripts is probably the best place to do it. If they are to be for all users, the usual mounting location is "/etc/fstab", but I'm not sure if that'll work for samba mounts. Anyone else have any input on this? If not, you may just need to create a script to accomplish the mounts, and name it something like "SambaMounts" and stick it in "/etc/init.d", then create a symlink in "/etc/rc2.d" named something like "S52SambaMounts" that points to that script (I believe networking is guaranteed to be working by the time scripts starting with S50 are run). Other members of this list may have better (more "correct") methods for doing this.

Hopefully this info might point you in the right direction.


Kent



Reply to: