Linux - NewbieThis 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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:
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?
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.