LinuxQuestions.org
Help answer threads with 0 replies.
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 11-14-2004, 05:55 PM   #1
DrakIE
LQ Newbie
 
Registered: Apr 2004
Location: norfolk, va
Distribution: Drake 8.0
Posts: 17

Rep: Reputation: 0
/etc/init.d


If I drop a shell script in this path (/etc/init.d) will it be run during the startup process? During the boot process all scripts in this path are run, aren't they?

I'd like to drop a quick mount smbfs script to map universal shares. Also, where can I set environmental variables for each user and set user specific scripts to run when a user logs in?

Thanks,
T$
 
Old 11-14-2004, 06:06 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
It depends on the distro -- Slackware runs all executable scripts in /etc/rc.d/init.d. Most distros use the System V startup methodology, however, and the script has to be linked from the appropriate /etc/rc.d/rcX.d directory, where X is the runlevel in question. So for instance, on Mandrake, if you look in /etc/rc.d/rc3.d/ you'll see a bunch of symlinks -- some start with S and others with K. Those starting with S, the init script that they link to is run with the "start" argument. Those starting with "K", the linked to init script is run with the "stop" argument. The easiest way to manage this, IMO, is to make your init script chkconfig compatible and use chkconfig to manage it.

An easier way to handle this is just add the commands you want done to your rc.local script, which gets run after all the other init scripts.

You can put global user configuration and such into /etc/profile.
 
Old 11-14-2004, 07:36 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Re: /etc/init.d

Quote:
Originally posted by DrakIE
If I drop a shell script in this path (/etc/init.d) will it be run during the startup process? During the boot process all scripts in this path are run, aren't they?

I'd like to drop a quick mount smbfs script to map universal shares. Also, where can I set environmental variables for each user and set user specific scripts to run when a user logs in?

Thanks,
T$
You don't need to place smb mounts in your startup scripts, the most logical place to put these is in your /etc/fstab file.

And if you want users to have custom environment or logins, you can place .bash_login files and or edit their .bashrc, .bash_profile or edit the global profile in /etc

You can also place .bash_logout files in their home directories if you want anything to occur after they logout of the system.. etc.

And regarding the startup scripts.. I do believe Mandrake is just like Redhat, you'd place the script in /etc/init.d which is usually a link to /etc/rc.d/init.d and you'd run a command like:

chkconfig --levels 345 <scriptname>

That would make the scripts start in runlevels 3, 4 and 5.. etc.
 
  


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
Kernel Panic No init found. Try passing init..... Adrian Baker Mandriva 2 02-28-2005 11:47 AM
Redhat linux9.0:System hangs,if gives init 3 or init 4 Sailaja Reddy Linux - Newbie 4 09-16-2004 03:19 AM
Kernal Panic: No init found. Try passing init= option to kernel raees Linux - General 12 03-18-2004 11:10 PM
error: No init found. Try passing the init= option to the Kernel neylitalo Linux - Laptop and Netbook 3 01-22-2004 09:34 PM
error "Kernel panic: No init found. Try passing init= option Anauj0101 Linux - Newbie 3 05-06-2003 10:18 PM

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

All times are GMT -5. The time now is 11: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