LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Shell script at system boot (https://www.linuxquestions.org/questions/linux-software-2/shell-script-at-system-boot-332337/)

linux-rulz 06-10-2005 07:49 PM

Shell script at system boot
 
Hey, just wondering, is there anyway to make a shell script run automatically when I first boot my system?

omes 06-10-2005 07:54 PM

What distro are you using?

- omes

mhallbiai 06-10-2005 07:57 PM

adding it to /etc/rc.local would be the easiest and cause it to run on each boot for any runlevel

if you wanted it to run only in particular runlevels then you may want to considfer adding it to /etc/init.d/ and adding the appropriate start/kill entries to your /etc/rc#.d/ directories

hope this helps

omes 06-10-2005 08:01 PM

Quote:

Originally posted by mhallbiai
adding it to /etc/rc.local would be the easiest and cause it to run on each boot for any runlevel
This depends on the distro he's using. The best way to start a script at boot would be the way that is default with the distro..

- omes

linux-rulz 06-10-2005 08:26 PM

Hi. Sorry, I should have given more information. I am running CentOS 4, which, for those who don't know, is RHEL4 minus Red Had Trademarks.

What I am trying to do is get the bttv driver (which did not come with Red Hat's kernel, I compiled it against their kernel myself) to load at boot. This is on two computers I am trying to do this. On one computer, I have to issue the command:

modprobe bttv

and on the other:

modprobe bttv tuner=2

This is my /etc/modprobe.conf file (on the computer without the tuner=2 option):

alias eth0 8139too
alias snd-card-0 snd-ens1370
options snd-card-0 index=0
install snd-ens1370 /sbin/modprobe --ignore-install snd-ens1370 && /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-ens1370 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-ens1370
alias char-major-81 snd-bt87x
alias usb-controller ehci-hcd
alias usb-controller1 uhci-hcd

I tried adding numerous entries to it to get the bttv driver to load (using the tuner=2 option on the other system is very important) but it would not work, so I was thinking of making a shell script to automatically run modprobe bttv at system boot. If you know what I should add to /etc/modprobe.conf to get this to work, that would be even more helpful.

mhallbiai 06-10-2005 08:29 PM

omes, i agree.

since linux-rulz did not specify and only has centOS listed for his distribution(s) that is the solution i provided. from what i have heard centOS is really nothing more than RHEL with RedHat (name, logos, etc) removed which uses rc.local. i could be mistaken, i have never used centOS.


All times are GMT -5. The time now is 02:04 PM.