On a centos 6 derivative (Amazon Linux), I have an init.d script ecrinit that is meant to enable/disable some services at system startup (based on contents of a properties file on disk):
if [[ "$nodeType" == "foo" ]]; then
#turn off mysql, turn on proftpd
service mysqld stop
chkconfig mysqld off # prevent lower-pri mysqld service from
chkconfig proftpd reset # re-enables at run levels 2-4
fi
Since start pri of ecrinit is 60 and of proftpd is 88, I expected the latter to be started by the boot process, since calling chkconfig reset above ensured that appropriate files exist in /etc/rc3.d (confirmed).
But that does not seem to be the case, as 'start' is never called on proftpd (I added a log statement to latter script's body to confirm) if I issue 'chkconfig proftpd off' before doing 'init 6'. In other words, it seems that the boot process checks contents of /etc/rc3.d before ecrinit is executed (and does not detect new files in same dir during boot process)...
Is that the expected behavior? If so, how can i control which services should be enabled on a given startup (and avoid manually starting them to preserve priority order)?
startup script heads
[root@lb1 ~]# head /etc/init.d/proftpd
#!/bin/bash
# $Id: proftpd.init,v 1.1 2004/02/26 17:54:30 thias Exp $
#
# proftpd This shell script takes care of starting and stopping
# proftpd.
#
# chkconfig: 234 88 12
# description: ProFTPd is an enhanced FTP server with a focus towards \
# simplicity, security, and ease of configuration. \
# It features a very Apache-like configuration syntax, \
[root@lb1 ~]# head /etc/init.d/ecrinit
#!/bin/bash
#
# chkconfig: 234 19 10
# description: Initializes stuff
chkconfig --list (after boot)
[root@lb1 rc3.d]$ chkconfig --list proftpd
proftpd 0:off 1:off 2:on 3:on 4:on 5:off 6:off
[root@lb1 rc3.d]$ chkconfig --list ecrinit
ecrinit 0:off 1:off 2:on 3:on 4:on 5:off 6:off
uname -a Linux 2.6.35.14-97.44.amzn1.i686 #1 SMP Mon Oct 24 16:03:22 UTC 2011 i686 i686 i386 GNU/Linux