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.
Hello world. I am nicely adapting to the Linux world, and find a new challenge everyday - which I actually kind of enjoy, as it helps me gain a better understanding of Linux, and what it does.
I was reading up on runlevels, init, rc.d, and other boot processes, when I came across one I just ca't seem to solve. Any comments or corrections would be welcome, as this one is driving me bonkers.
I must clarify, this is not an emergency, just one of those things that I can't seem to google successfully, and I have perused quite a few docs to no avail.
During boot up, after init takes over, it implements the inittab and starts all the processes, yada yada yada.
I have read that the last file acted upon by init is /etc/rc.d/rc.local
Am I correct thus far?
Soooo, being the curious lion I am, i noticed that the only action in this file is:
Code:
touch /var/lock/subsys/local
My questions are two. The second one is somewhat subjective, so I will start with the easy straightforward one first:
1. What does this command do FOR the system? (I am using Fedora Core 2) I understand the concept of touch, but what is this actually doing or checking or setting? And why (if it even is) is this touch command on that particular file necessary?
2. What kind of cool things can I do with this /etc/rc.d/rc.local file? Ideas, suggestions, experiences?
btw
Thanks to all you peeps out there who make learning this new way of life so fun and remarkably easy to understand. These forums and website is a tremendous aide, and have solved countless other hiccups along the way.
/etc/rc.d/rc.local
this is used for any local commands you want started ......
I put the parameters for hdparm which enables DMA..........
Also I use the emu10k1 driver from sourceforge for my SB Live sound card.........so I also put a line in to mobprobe the module so sound works when KDE fires up..............
What this does is create a lock file that tells the system that 'local' is up and running already. It prevents the script from being run twice, as it will fail until the lockfile is removed, which will happen when you shut down.
Typically this is used with bigger services such as database servers and so forth to make sure they are not started twice.
Basically, any command you want to have run when your system starts can go in rc.local. Typically, for me, I put stuff in here if/when I'm not sure what other startup procedure is supposed to do what I want. As an example, I used to have a line in rc.local to do some touch up networking commands that I now have in the startup script for my firewall since they are more appropriate there, but either place is fine. As you learn about new things in Linux, the rc.local script is a good place to load them until you figure out what other startup script to put them in.
Nothing 'checks' for rc.local. It is simply the last rc script run before you arrive at a login prompt when booting...therefore, it is a good place to put commands you need run at boot that don't warrant their own full-blown rc script.
I see what you mean. To tell the truth I don't think anything looks there. I have never seen a lock mechanism in place for the rc.local script. Like I was saying, usually it is only used for bigger services. However, it is usually checked by the script itself.
If you have a look at one of your more complicated rc scripts you may see in the 'start' function something like (pseudo code):
Code:
start() {
if /var/lock/subsys/myapp exists; then
echo "myapp already started"
exit
else
touch /var/lock/subsys/myapp
/command/to/start/myapp
fi
}
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.