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.