Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-19-2008, 11:20 AM
|
#1
|
|
Member
Registered: May 2008
Distribution: Slackware
Posts: 949
Rep:
|
Where do I place startup scripts?
I've made a few shell scripts to load up some modules, etc. Where do I place the scripts to have them run during boot?
|
|
|
|
08-19-2008, 11:36 AM
|
#2
|
|
LQ Veteran
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,756
|
For most distros, you put them in /etc/init.d and then use the chkconfig command to put links into the appropriate boot directories (/etc/rcX.d). Slackware is a little different in that you use /etc/rc.d. If you state what distro you're using we can probably be more specific.
|
|
|
|
08-19-2008, 11:37 AM
|
#3
|
|
Senior Member
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853
Rep:
|
As Hangdog42 stipulated, Slackware uses the /etc/rc.d folder for its start-up scripts. Whereas Debian uses /etc/init.d.
|
|
|
|
08-19-2008, 04:29 PM
|
#4
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
Some of us just put these scripts into /etc/rc.local (if this file exists on your distro, I suggest you read and use it)
|
|
|
|
08-19-2008, 05:03 PM
|
#5
|
|
Member
Registered: May 2008
Distribution: Slackware
Posts: 949
Original Poster
Rep:
|
Using Fedora 8, Debian 4.0, and BT3
|
|
|
|
08-19-2008, 05:11 PM
|
#6
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
Quote:
|
Using Fedora 8, Debian 4.0, and BT3
|
So, is the file /etc/rc.local there or not?
Have you tried putting your scripts there?
Please don't expect us to do ALL your homework.
|
|
|
|
08-19-2008, 05:13 PM
|
#7
|
|
Member
Registered: Jul 2008
Posts: 60
Rep:
|
Quote:
Originally Posted by Hangdog42
For most distros, you put them in /etc/init.d and then use the chkconfig command to put links into the appropriate boot directories (/etc/rcX.d). Slackware is a little different in that you use /etc/rc.d. If you state what distro you're using we can probably be more specific.
|
It looks to me as though Debian might do it differently too.
The choices for both /stc/init.d and /etc/rc.local are overwhelming (see below for extract). Any additional advice?
I just want to run the "hdparm" command at boot.
In Debian Etch, The (edited) choices of the suggested locations are:
[felixk@ ~]$ locate rc.local
/etc/init.d/rc.local
/etc/rc.local
/etc/rc2.d/S99rc.local
/etc/rc3.d/S99rc.local
/etc/rc4.d/S99rc.local
/etc/rc5.d/S99rc.local
[felixk@ ~]$ locate init.d
/etc/init.d
/etc/init.d/alsa
/etc/init.d/alsa-utils
/etc/init.d/anacron
/etc/init.d/atd
/etc/init.d/avahi-daemon
/etc/init.d/bootclean
REMAINDER SNIPPED.
felixk
|
|
|
|
08-19-2008, 05:30 PM
|
#8
|
|
Member
Registered: May 2008
Distribution: Slackware
Posts: 949
Original Poster
Rep:
|
yeah in BT3 there's
/etc/rc.d/rc.0
/etc/rc.d/rc.4
/etc/rc.d/rc.6
So I would just place a command in an appropriate area of one of those files to run a script? So by placing a command to run a shell script in rc.4, this command would be run when I run init 4 or user mode 4?
Would I have to run chkconfig in this situation?
Also, there are
/etc/rc.d/rc0.d/
/etc/rc.d/rc1.d/
/etc/rc.d/rc2.d/
/etc/rc.d/rc3.d/
/etc/rc.d/rc4.d/
/etc/rc.d/rc5.d/
/etc/rc.d/rc6.d/
These are empty, but these are for daemons? How would I use these if I wanted a daemon running? Do I need to place a shell script in there to start a daemon?
|
|
|
|
08-20-2008, 07:10 AM
|
#9
|
|
LQ Veteran
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,756
|
Quote:
|
So I would just place a command in an appropriate area of one of those files to run a script?
|
You could do it that way, however it becomes a pain to manage if you get several scripts. Hence the suggestion to use either rc.local or /etc/init.d. Also, at least with Fedora, there is a startup and a shutdown link in every one of those directories.
Quote:
|
So by placing a command to run a shell script in rc.4, this command would be run when I run init 4 or user mode 4?
|
Yes, that is right.
Quote:
|
Would I have to run chkconfig in this situation?
|
Again, for manageability you do want to look into what chkconfig does. You don't need to use it, but it is there to make life easier.
Quote:
|
These are empty, but these are for daemons?
|
No, those are there for the same reason the others are. Each of those are used to customize a runlevel. Granted, not all of them are used by all distros, but the intent is the same. If you want a daemon running in a specific runlevel, you need to have the script linked from the appropriate directory.
|
|
|
|
08-21-2008, 04:59 PM
|
#10
|
|
Member
Registered: Jul 2008
Posts: 60
Rep:
|
Quote:
Originally Posted by trist007
yeah in BT3 there's
/etc/rc.d/rc.0
/etc/rc.d/rc.4
/etc/rc.d/rc.6
|
Debian does do it differently!
Looking at the contents of the files - instead of just finding where
they are - helps.
http://linuxquestions.cachefly.net/i..._lq/icon12.gif
- the currently existing "/etc/rc?.d/S99rc.local" files just link to a
script in /etc/init.d;
- that script says "run /etc/rc.local - if it exists".
At present, it exists, but is empty.
Problem solved.
My thanks for the encouragements.
Felix
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:39 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|