From this changing How to change Linux services startup/boot order? changing the values of the symbolic links it is evident that startup order is changed.

In debian derivatives we use

update-rc.d apache2 defaults 20 80

Do we have similar command in Centos/Redhat and ?

if so what it is ?

and what should be possible changes in init scripts header ?

Note: I should use init system (not any systemd or upstart)

  • Which versions of the named OS are you referring to, it's important? – user9517 Feb 8 '16 at 10:22
  • @Lain Centos 6.5 is the current version – forum.test17 Feb 8 '16 at 10:35

An alternative will be to change the line starting with # chkconfig: in the service init script directly. This is explained in the chkconfig(8) man page.

Runlevel Files

Each service which should be manageable by chkconfig needs two or more commented lines added to its init.d script. The first line tells chkconfig what runlevels the service should be started in by default, as well as the start and stop priority levels. If the service should not, by default, be started in any runlevels, a - should be used in place of the runlevels list. The second line contains a description for the service, and may be extended across multiple lines with backslash continuation.

For example, random.init has these three lines:

# chkconfig: 2345 20 80
# description: Saves and restores system entropy pool for \
#              higher quality random number generation.

This says that the random script should be started in levels 2, 3, 4, and 5, that its start priority should be 20, and that its stop priority should be 80. You should be able to figure out what the description says; the \ causes the line to be continued. The extra space in front of the line is ignored.

After changing the script, if you will need to run the chkconfig command (as root) with the reset option for that service. With "reset", chkconfig will automatically create start/stop symlinks in the configured run levels with given priorities.

| improve this answer | |
  • Thanks for info, I was wondering can I use CHKCONFIG with Default-start and Default-stop – forum.test17 Feb 8 '16 at 10:56
  • I don't think that will be possible. – Diamond Feb 8 '16 at 11:12
  • +1 for the chkconfig reset command -- crucial. – matias elgart Jun 29 '18 at 20:16

You can manually rename symlinks in your /etc/rcX.d directories to change boot order.

UPD: Under RHEL / CentOS you use command called ntsysv or chkconfig.

| improve this answer | |
  • I know changing the symlinks works, but would like to know is there any other alternative – forum.test17 Feb 8 '16 at 10:36

I would like add more details to above answer

in order to start the scrips especially in centos there is no such alternative like


in Debain ,

Easiest way is to change the scripts manually as described here and e.g. code from /etc/init.d/postfix

# postfix      Postfix Mail Transfer Agent
# chkconfig: 2345 80 30
# description: Postfix is a Mail Transport Agent, which is the program \
#              that moves mail from one machine to another.
# processname: master
# pidfile: /var/spool/postfix/pid/master.pid
# config: /etc/postfix/main.cf
# config: /etc/postfix/master.cf
# Based on startup script from Simon J Mudd <sjmudd@pobox.com>
# 25/02/99: Mostly s/sendmail/postfix/g by John A. Martin <jam@jamux.com>
# 23/11/00: Changes & suggestions by Ajay Ramaswamy <ajayr@bigfoot.com>
# 20/01/01: Changes to fall in line with RedHat 7.0 style
# 23/02/01: Fix a few untidy problems with help from Daniel Roesen.

# Provides: postfix MTA
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop postfix
# Description: Postfix is a Mail Transport Agent, which is the program that
#              moves mail from one machine to another.
| improve this answer | |

Warning, issue a service reset sets the service to off. You need to run with service on afterwards.

| improve this answer | |
  • The question is about changing the start-up order of services, not about a "service reset". – telcoM Jan 9 '18 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.