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!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
ok, so you want to start a service on boot. you've not told us what distribution you're using etc... we're not psychic, but try "chkconfig <service name> on" on redhat / fedora / misc redhat derivaties.
Distribution: Debian Etch (w/ dual-boot XP for gaming)
There are two possible meanings here, so I'll cover them both:
Edit: after the OP's follow-up, it was confirmed it's the second one. I'll leave this first bit in for reference's sake:
There is a file in your home directory called .bash_profile. Since it starts with a dot (but doesn't end with one, that was a full stop!) it's a hidden file so you won't normally see it. In any event, the contents of this file are executed one by one when you log in, as if you typed them manually into a console. (The exception to this is lines starting with an octothorpe, '#'; these are considered comments and ignored).
So basically, to run something automatically ever time you log in, you can add the commands to your .bash_profile file and it'll run them automatically.
OTOH, there are many services that you want to be running for as long as Linux is loaded, even when no-one's logged on. In this case, you need to know how your distribution handles startup (there are subtle differences between them). A little background, this is skippable if you wish. Most of them have their startup scripts in either /etc/init.d or /etc/rc.d. These are just normal shell scripts, and can be as simple as a list of commands on multiple lines (as with .bash_profile above). There's nothing special about this folder AFAIK, it's just the standard place to put startup scripts.
The real magic comes when the computer boots into a particular runlevel - it's it's booting into runlevel X, it will look in the folder /etc/rcX.d and run all the files it finds in there that start with an S, in ascending order of the number. Sounds confusing? Take a look at, say, /etc/rc3.d. Mine, for example, is
So the system would first execute S10sysklogd, then S11klogd, etc, all the way up to S99oracle, S99rmnologin and S99stop-bootlogd. Note that the name after the S and the number isn't important at all, other than as a reminder of what that script does. (If you're wondering about the K08vmware, scripts starting with a K are called when that runlevel is exited. S = start, K = kill.)
So why did we go to the trouble of putting scripts in /etc/init.d? If we take a closer look at one of the above scripts with ls -l, we see
So these scripts are nearly always symlinks to the scripts in your repository (makes sense, since many programs will be run in several runlevels, and it saves having the same file in several folders).
The actual 'how to do it' bit. So to get something to run at startup, you need a script to run it (which can be as simple as the fully qualified name of the executable, e.g. /path/to/directory/the_executable). It's best to put this in /etc/init.d or /etc/rc.d, just so you know where it is and what it's for. Then, you need to create a symlink to this script in your desired runlevels. For most distributions, runlevel 3 is the normal console login and runlevel 5 is the graphical login. When it comes to deciding on a number, it's probably best to go with 99 since then it'll run after everything else has finished loading, which is probably what you want. So let's say you have your script in /etc/rc.d. You'll want to (as root):
~ # cd /etc/rc3.d
rc3.d # ln -s /etc/rc.d/your_script S99name_of_the_program
rc3.d # cd rc5.d
rc5.d # ln -s /etc/rc.d/your_script S99name_of_the_program
Next time you start up the computer (in either one of those runlevels, to be picky), it'll run your program with it. Voila!
You know dude, I love you Dtsazza, I found the problem, it was when I was experimenting and cocked up. (real newbie here :P). I was trying to get port forwarding to work, but didn't have any luck at all.. but when I changed my firewall script it seemed to load it from a different area on the HDD and not my etc/init.d/firewall.sh, too bad it failed bitterly... - -;;. But it turned out to be in my rcS.d file . For some reason it changed when I run the file, but didn't change back when I ran the older "working" file .
Distribution: Debian Etch (w/ dual-boot XP for gaming)
How long ago was it you got your friend to do the install? I've installed Debian several times in the last few months (on different computers ) and I haven't had any problems with it. You might get unlucky with unsupported hardware, but in most cases it's all straightforward and not overly complicated considering that you're installing an OS!
You can at least boot up the installer - it's pretty clear when it's going to start installing files, so as long as you don't get to that stage (or save any changes to your partition table) you haven't actually changed anything. It's not that tough and there's not many questions to answer - all the hardware-detection stuff is automatic, you just get to name your computer and decide which software bundles you want installed (out of things like "Desktop", "Graphics", "Database" etc), stuff like that. Anyway, nothing ventured, nothing gained!
(Though sadly a positive attitude won't solve HD space issues )
when mine was being installed, I think I did it from source, but I'm not entirely sure, I just couldn't get into the GUI window x or whatever, but then we had to change some standard settings in the resolution files and all sorts of things due to my hardware not supporting various things... My monitor doesn't suppose 24bit so we had to change that.. yup, it was also on a seperate partition, then when my windows fucked up, it took Debian down with it. I should try to reinstall and toy with it, learn more about it. ^_^'