LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices

Reply
 
LinkBack Search this Thread
Old 09-16-2005, 04:50 AM   #1
Johnburrell
Member
 
Registered: May 2004
Distribution: FC3
Posts: 73

Rep: Reputation: 25
Commands executed at boot time


I want to execute the following commands when my laptop is booted -

cp /etc/alsamix.conf /etc/asound.state
/sbin/alsactl restore 0
chmod 666 /dev/snd/*

Obviously it is essential that these are executed after the files in /dev/snd are created at boot time. I have been told to put these commands in /etc/rc.d/rc.local but lfs doesn't use rc.local - at least my version doesn't have it.

So to the question - where is the best place in lfs to put these commands so that they are executed at the correct time and with the required privilege when a user boots the machine?

Thanks
 
Old 09-16-2005, 10:07 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 7,514
Blog Entries: 1

Rep: Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139
Hi,

Most elegant would be to create your own script in /etc/rc.d/init.d/ and link it to the appropriate /etc/rc.d/rc<number>.d/ directory(ies).

- Pro's:
Own script, no 'alien' stuff in the already excisting scripts.
You decide when it is started (by means of the link in rc<number>.d directories

- (possible) Con's:
Need to write script.
Need basic understanding of the runlevels.

If you need help setting up the above: Just ask.
 
Old 09-17-2005, 01:56 AM   #3
shotokan
Member
 
Registered: Mar 2005
Distribution: slackware, LFS
Posts: 204

Rep: Reputation: 30
Quote:
I want to execute the following commands when my laptop is booted -

cp /etc/alsamix.conf /etc/asound.state
/sbin/alsactl restore 0
chmod 666 /dev/snd/*
The BLFS Bootscripts package has the scripts for doing that.
 
Old 09-18-2005, 01:56 PM   #4
sundialsvcs
Senior Member
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 3,682

Rep: Reputation: 329Reputation: 329Reputation: 329Reputation: 329
When the computer starts-up, the first thing that it does is to run a program called init. At startup, that program refers to /etc/inittab based on the selected "runlevel" (usually 5).

The typical contents of an inittab will cause all of the commands in /etc/rc.d/rc5.d/ to be executed. All file-names beginning with 'S' (startup) are executed, in alphabetic order. The 'K' files are used similarly at shutdown.

You will notice that all of these files are symbolic-links, and definitely numbered, so that their sequence of execution is certain.

Usually, the inittab then specifies that /etc/rc.d/rc.local is scanned or executed last, if it exists. Its contents and purpose are the same.

What you'll do is to build a command-file containing the necessary instructions, put it (maybe...) in /etc/init.d, and link to it from the appropriate /etc/rc.d/rc.# directories, or from rc.local.

It is very important to understand init and the central role that it plays in the operation of the entire system for the entire duration of its uptime.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel compile time and boot time lordofring Programming 1 11-13-2005 02:04 AM
Time commands from command line ToothlessRebel Linux - Newbie 1 03-09-2005 10:52 AM
Commands automatic during boot leemac Linux - Newbie 4 02-15-2005 01:18 PM
Adding Boot Commands pjpeter Linux - Newbie 6 01-25-2005 08:10 PM
how to add commands to boot? alexii86 Linux - Newbie 8 10-09-2003 01:18 AM


All times are GMT -5. The time now is 06:09 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration