• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2401
  • Last Modified:

change startup priority of services

Hello,

I am using Red hat Enterprise Linux AS release 3.

I have 3 custom services : service_1, service_2 and service_3. Now i want these services startup in order:
            service_1,
            service_2,
            service_3            
when the system startup.

What should I do now?

Thanks.

0
freshrain
Asked:
freshrain
1 Solution
 
LuxanaCommented:
what you should do now is to have a look to this link:
section:
init is clever enough to start services in the correct order

http://www.freesoftwaremagazine.com/articles/installation_seq_linux?page=0,1


use runlevel to find put in what runlevel are you using. Assume that you are using level 2 so than go to /etc/rc2.d and play with numbers of your scripts.

hope this helps

lubo
0
 
AnonymouslemmingCommented:
On RHEL, you shouldn't manually change the Snn number of a script. You should use chkconfig to change the priority of the script.

In the top of each script, you should have something like the following:

#!/bin/bash
#
# Init file for OpenSSH server daemon
#
# chkconfig: 2345 55 25
# description: OpenSSH server daemon

The line you are interested in is the chkconfig: line.

The first group of numbers after the chkconfig: are the runlevels that the script will be called in. The following two groups of numbers are the startup order and shutdown order. So in this example, SSH will be started about midway through the init process (55) and shutdown around a quarter of the way through the shutdown process (25)

First, stop the service and remove it from chkconfig by doing
chkconfig --del  service_1

After changing the startup numbers, re-add the script and set it to start at boot time by doing
chkconfig --add service_1
chkconfig service_1 on

If your services are service_1, service_2 and service_3, and you set them to 99 01 (start last, end first), then they will be started in the right order. This is because the startup system first gets the number (99) and if it finds more than 1 script at 99, starts the scripts in alphabetical order.

This won't help you if your services are named something like foo, bar, grr - in this case, bar would start before foo. The solution here would be to set bar to foo to 97, bar to 98 and grr to 99

Hope that helps
0
 
subodhshriCommented:
You can simply setup dependency on these service. So these services startup before others
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now