LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 01-10-2006, 10:22 AM   #1
kimck098
LQ Newbie
 
Registered: Jan 2006
Location: UK, Hampshire
Distribution: Windows XP Pro, Knoppix, Debian
Posts: 10

Rep: Reputation: 0
How do you boot files on bootup?


I want to make a specific file boot on startup not when I enter my GUI, I'm using Knoppix and want to boot a file on startup when it loads into the Console at the start, anyone know how?
 
Old 01-10-2006, 10:45 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you want to boot a file?? what does that mean? you boot operating systems, not files.
 
Old 01-10-2006, 10:47 AM   #3
kimck098
LQ Newbie
 
Registered: Jan 2006
Location: UK, Hampshire
Distribution: Windows XP Pro, Knoppix, Debian
Posts: 10

Original Poster
Rep: Reputation: 0
I want to make a file start when it boots up. Like my firewall which also forwards the internet to my networked computers. It's one of those placed in the etc/init.d file named firewall.
 
Old 01-10-2006, 10:53 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 01-10-2006, 10:53 AM   #5
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
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
Code:
K08vmware    S20dbus-1   S20postgresql-7.4  S89atd     S99oracle
S10sysklogd  S20exim4    S20samba           S89cron    S99rmnologin
S11klogd     S20inetd    S20ssh             S90vmware  S99stop-bootlogd
S18portmap   S20lpd      S21fam             S99gdm
S20cupsys    S20makedev  S21nfs-common      S99kdm
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
Code:
lrwxrwxrwx  1 root root 18 2006-01-03 11:11 /etc/rc3.d/S10sysklogd -> ../init.d/sysklogd
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):
Code:
~ # 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!

HTH,
Andrzej

Last edited by Dtsazza; 01-10-2006 at 10:55 AM.
 
Old 01-10-2006, 12:31 PM   #6
kimck098
LQ Newbie
 
Registered: Jan 2006
Location: UK, Hampshire
Distribution: Windows XP Pro, Knoppix, Debian
Posts: 10

Original Poster
Rep: Reputation: 0
Smile

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 .

Thanks again.

The (a.k.a Kimck098)
 
Old 01-11-2006, 04:05 AM   #7
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
Heh, half the fun of Linux is playing around, breaking things then figuring out just how to get them back to normal. It teaches you much more than any HOWTO can.

Glad to be of assistance.
 
Old 01-11-2006, 10:59 AM   #8
kimck098
LQ Newbie
 
Registered: Jan 2006
Location: UK, Hampshire
Distribution: Windows XP Pro, Knoppix, Debian
Posts: 10

Original Poster
Rep: Reputation: 0
I wasn't getting my hopes up on searching for the answer, but asking people with expericence is always alot nicer, and yeah, HOWTO suck for this sorta thing :P

I'm thinking about installing debian to my HDD again, but theres some problems :P.

1. Not enough HDD space and not enough space in my PC for a new HDD, bang goes that idea.

2. I have no idea how to install debian, I got a friend to do it last time, and boy was he p***ed off when he left, lol

Last edited by kimck098; 01-11-2006 at 11:13 AM.
 
Old 01-11-2006, 11:49 AM   #9
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
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 )
 
Old 01-12-2006, 10:59 AM   #10
kimck098
LQ Newbie
 
Registered: Jan 2006
Location: UK, Hampshire
Distribution: Windows XP Pro, Knoppix, Debian
Posts: 10

Original Poster
Rep: Reputation: 0
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. ^_^'
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gnome fails to load on login after bootup - unless bootup first in win xp doubletruncation Fedora 6 12-07-2005 08:32 AM
LILO / boot disk / WinXP all lock on bootup Sniper667 Linux - Software 2 03-09-2005 03:10 AM
Missing files for NFS on bootup.... vinoloco Fedora 12 03-04-2005 03:49 PM
find my boot: prompt during bootup cyberfox1234 Linux - Newbie 2 12-22-2004 05:43 AM
Knoppix bootup files question pauly99 Debian 2 07-08-2004 12:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration