LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 01-03-2006, 07:21 PM   #1
bhomass
Member
 
Registered: Nov 2005
Posts: 69

Rep: Reputation: 15
startup scripts not running


I added a startup script in /etc/init.d

I restarted the system quite a few times, but the script did not run.

what do I have to do to get it to run? where do I see the printouts from this script?

it is a Debian kernel version 2.6.8.
 
Old 01-03-2006, 08:22 PM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
/etc/init.d is where you generally place startup scripts. Then you normally create a link to them from the directory(s) /etc/rc1.d, /etc/rc2.d, /etc/rc3.d, etc., where the number indicates the runlevel. For single user mode the scripts are linked from /etc/rcS.d Debian by default boots to runlevel 2 (at least that's the way mine installed by default). So you'd want to put links in that /etc/rc2.d directory.

The script links take the form of Sxxname where xx are digits. For example, an apache webserver startup script might be linked as S50apache. Lower numbers are run first, so for example S40firewall would run before S50apache. If you want something to kill a server at a given runlevel rather than start it, the link's name starts with a K, e.g., K50apache. These links need to use uppercase S and/or K to actually run. Convention says that if you have something you no longer want to run, but for some reason do not want to totally delete it, replace the first letter with a lowercase. e.g., s50apache would be a link that would not be run. Your actual scripts in /etc/init.d should understand at least "start" and "stop". Check things that you have in these directories as part of the distro base install for examples.

There are different programs that help you manage startup scripts, but the above is what they are doing under the surface. I've always just done it manually myself.
 
Old 01-03-2006, 09:23 PM   #3
wrj
Member
 
Registered: Aug 2003
Location: Canada/US
Distribution: Ubuntu, Arch
Posts: 84

Rep: Reputation: 15
I think rcconf is a good tool to help you manage your startup scripts, but as haertig said, knowing what goes on under the hood is a good idea.
 
Old 01-03-2006, 09:25 PM   #4
bhomass
Member
 
Registered: Nov 2005
Posts: 69

Original Poster
Rep: Reputation: 15
could you point out something for me to read up on all the run levels. I don't know what they are.

I do understand what you said about linking the startup scripts though.
 
Old 01-03-2006, 10:44 PM   #5
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by bhomass
could you point out something for me to read up on all the run levels. I don't know what they are.

I do understand what you said about linking the startup scripts though.
Not much need to read up on the runlevels 2-5 are configured identically in Debian with the default level being 2 (1 is single user rescue mode 6 shutdown) if you wish to create the proper links for your script then check man update-rc.d.
 
Old 01-03-2006, 11:05 PM   #6
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by bhomass
could you point out something for me to read up on all the run levels. I don't know what they are.
Runlevels are what you want them to be. Generally runlevel 0 means reboot, runlevel 6 means shutdown, runlevel 1 is single user. That leaves 2 thru 5 for you to define as you wish. As happytux said, Debian defines 2-5 all the same, but that doesn't mean you can't change them for your own purposes. Think of a runlevel as a collection of services or programs that you want to start/stop as a group. For example, you might decide that runlevel 2 will be your normal multiuser mode (the Debian default). You might then define runlevel 3 as the same as 2, but with an extremely tight firewall setup that blocks all Internet traffic but allows LAN traffic. You just create yourself a tight firewall script and link that into /etc/rc3.d/S40nowan or something like that. Don't forget to add K40nowan scripts to the OTHER runlevels to undo what the S40nowan script did.

To move between runlevels, as root, enter "telinit x", where x is your desired new runlevel. e.g., "telinit 1" to move to single user mode. You can also use the "shutdown" command to move to different runlevels. The "init" command also. Check the manpages. You don't normally go changing runlevels willy nilly on a system with multiple users. You tend to log them off (depending on how you've set things up). They don't always appreciate this. But you're root, and you can do whatever you want! They don't call you the "super abuser" for nothing ;-)
 
  


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
Mandriva startup scripts (need to add something to startup before X starts) thunderweasel Mandriva 3 01-01-2006 12:55 AM
Running scripts on startup darrenjhopkins Linux - Newbie 7 12-09-2004 04:51 AM
running scripts on startup kaguru Linux - Newbie 2 01-10-2004 06:59 AM
Running Scripts/Commands on Startup drknow Linux - Newbie 4 01-09-2004 05:14 AM
startup scripts amphion Linux - Newbie 8 03-28-2003 01:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 10:22 AM.

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