Startup order of services on RHEL or CentOS

The startup order of services on Red Hat Enterprise Linux (and very likely other flavours) is determined by the numerical prefix on the symbolic links in /etc/rc3.d/ (for run level 3), /etc/rc5.d/ (for run level 5), and so on.

When adding a service (chkconfig –add my_service –level 35), you can specify startup order by including a chkconfig clause in the header:

#!/bin/sh
#
# chkconfig: 35 59 80

The above service should start at run level 3 and 5 as the 59th service to run (the numbering is sparse, so there isn’t necessarily as a 58th service).

The 80 specifies the shut down order.

Obviously, do not rename the symbolic links yourself. Use chkconfig to manage them.

Published by

Leons Petrazickis

I'm a full-stack developer at IBM Digital Business Group. I do Ruby, Node, Python, Hadoop, Spark, as well as web scale devops with Docker and Terraform. My opinions are my own.