Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripts in /etc/init.d 3

Status
Not open for further replies.

ddrillich

Technical User
Jun 11, 2003
546
US
Good Day,

We just had a lab shut-down. When the servers came up, some processes end up running and some not. I wonder which scripts in the /etc/init.d directory are being run when a server boots up. All of them?

In addition, we have some dependencies. For example, the process on the license server (DiSH) has to come first so other processes on other servers can obtain the license and come up. Is there a way to configure such a dependency in the /etc/init.d scripts?

Regards,
Dan
 
Hi

Note that /etc/init.d is just a directory to store the init scripts.

Most frequently there are separate directories /etc/rc0.d/ .. /etc/rc6.d/ ( corresponding to each run level ) containing symlinks to the scripts in /etc/init.d. Those symlinks names look like S50service ( for starting the service ) or K50service ( for stopping the service ). When a runlevel is entered or left, the scripts linked in the matching directory are executed. The number between 00 and 99 indicates the order to run the init script.

Note that the directory and file names may widely vary. There are init systems which uses a text file instead of symlinks to enumerate the services to start and stop. Also some service managers uses special comments placed in the init scripts, which describe the dependencies.

So better specify your distribution. Maybe the init system too.


Feherke.
 
if your distro uses chkconfig to enable & disable services (Red hat & I think Debian both use this) then the priority of shut-down & start up can be defined in the script

the symlinks created are named SXX-Name & KXX-Name

where XX defines the order in which the services are started & stopped

Computers are like Air conditioners:-
Both stop working when you open Windows
 
Many thanks. Some information about the Linux being used -

Code:
[autonomy@sbkj2ksrchsts01 init.d]$ uname -a
Linux sbkj2ksrchsts01 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x86_64 x86_64 GNU/Linux

[autonomy@sbkj2ksrchsts01 init.d]$ cat /proc/version
Linux version 2.6.9-67.ELsmp (brewbuilder@hs20-bc1-5.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-8)) #1 SMP Wed Nov 7 13:56:44 EST 2007

[autonomy@sbkj2ksrchsts01 init.d]$ cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 6)

Regards,
Dan
 
I'll add one as well ; - ).
Under /etc, I see -

Code:
lrwxrwxrwx   1 root root      15 Jan 15  2008 rc.sysinit -> rc.d/rc.sysinit
lrwxrwxrwx   1 root root      13 Jan 15  2008 rc.local -> rc.d/rc.local
drwxr-xr-x  10 root root    4096 Jan 15  2008 rc.d
lrwxrwxrwx   1 root root      10 Jan 15  2008 rc6.d -> rc.d/rc6.d
lrwxrwxrwx   1 root root      10 Jan 15  2008 rc5.d -> rc.d/rc5.d
lrwxrwxrwx   1 root root      10 Jan 15  2008 rc4.d -> rc.d/rc4.d
lrwxrwxrwx   1 root root      10 Jan 15  2008 rc3.d -> rc.d/rc3.d
lrwxrwxrwx   1 root root      10 Jan 15  2008 rc2.d -> rc.d/rc2.d
lrwxrwxrwx   1 root root      10 Jan 15  2008 rc1.d -> rc.d/rc1.d
lrwxrwxrwx   1 root root      10 Jan 15  2008 rc0.d -> rc.d/rc0.d
lrwxrwxrwx   1 root root       7 Jan 15  2008 rc -> rc.d/rc

[autonomy@sbkj2ksrchsts01 rc0.d]$ pwd
/etc/rc.d/rc0.d

[autonomy@sbkj2ksrchsts01 rc0.d]$ \ls -ltr | grep autonomy
lrwxrwxrwx  1 root root 26 May  9  2008 K96autonomy-content -> ../init.d/autonomy-content

Regards,
Dan


 
You are red hat based so it will be using chkconfig to enable & disable Daemons

you need to add a line similar to the following to your init scripts
Code:
# chkconfig - 85 15

this specifies the run levels (All) as well as the start-up position (85) & shut-down possition (15) for the Daemon, in this case httpd

the dameon should be enabled with
Code:
 chkconfig httpd on

and disabled with
Code:
chkconfig httpd off

as an alternative specific run levels can be specified if needed

Computers are like Air conditioners:-
Both stop working when you open Windows
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top