Whats the difference between using chkconfig on and using chkconfig --add?
I'm running CentOS 6.2 - I've just migrated some applications over to a failover server, and copied their init scripts into /etc/init.d.
I've made them executable, added them to chkconfig, with chkconfig -add, set their levels, made sure they're residing in /etc/rc.d/ - made sure I can execute them from rc2.d etc. The permissions are the same on both servers. They're also running in the same order as on the primary server
Yet on reboot they don't start. Any ideas?
The offenders are these:
jetty 0:off 1:off 2:on 3:on 4:on 5:on 6:off
smart 0:off 1:off 2:on 3:on 4:on 5:on 6:off
/etc/init.d:
-rwxr-xr-x. 1 root root 14456 Mar 13 20:21 jetty
-rwxrwxrwx. 1 root root 5829 Mar 29 09:58 smart
/etc/rc.d/rc3.d
lrwxrwxrwx. 1 root root 15 Mar 29 19:21 S99jetty -> ../init.d/jetty
lrwxrwxrwx. 1 root root 11 Mar 26 17:12 S99local -> ../rc.local
lrwxrwxrwx. 1 root root 15 Mar 29 19:21 S99smart -> ../init.d/smart
I've checked, and I'm in run level 3. I've checked their logs, and there's no indication that that they've been started. I can start them manually easily - and other services are starting normally.
I'm completely out of ideas really.
OS: Centos 5.7
My application script starts like this (/etc/init.d/myapp):
#!/bin/sh
# chkconfig 2345 85 60
# description: my application controller
# processname: myapp
NAME=MyApp
DIR=/opt/myapp/
RUN_AS=root
### BEGIN INIT INFO
# Provides: myapp
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Starts the myapp application
### END INIT INFO
Chkconfig status
chkconfig --list | grep myapp
myapp 0:off 1:off 2:on 3:on 4:on 5:on 6:off
myapp accepts start | stop | restart | force-reload and they're all tested to work
myapp controller basically needs to start some daemon services for the application. If I run service myapp start
after the system is rebooted, everything works fine. But for some reason, chkconfig is not starting it up automatically. Can anyone explain what I may be doing wrong?
UPDATE:
Thanks to cjc's information, it appears that my application controller is loading prior to some required services such as mysql.
Here's the result of a quick search:
find /etc -name rc* -type d | xargs ls | grep myapp
K50myapp
K50myapp
S50myapp
S50myapp
S50myapp
S50myapp
K50myapp
So why is the order set to 50 when in the script I've set to 85(start) 60(stop)? And how can I change this?
Solution (as pointed out by cjc in comments to his answer)
Incorrect syntax:
# chkconfig 2345 85 60
Correct to (colon needed after chkconfig):
# chkconfig: 2345 85 60
I am trying to add to the auto start at boottime a linux service through the
chkconfig -add <servicename>
and I get a message saying
service <servicename> does not support chkconfig
I am using Red Hat Enterprise 4. The script I am trying to add to the autostart at boottime is the following:
#!/bin/sh
soffice_start() { if [ -x /opt/openoffice.org2.4/program/soffice ]; then
echo "Starting Open Office as a Service"
#echo " soffice -headless -accept=socket,port=8100;urp;StarOffice.ServiceManager
-nofirststartwizard"
/opt/openoffice.org2.4/program/soffice
-headless -accept="socket,host=0.0.0.0,port=8100;urp;StarOffice.ServiceManager"
-nofirststartwizard & else
echo "Error: Could not find the soffice program. Cannot Start SOffice." fi }
soffice_stop() { if [ -x /usr/bin/killall ]; then
echo "Stopping Openoffice"
/usr/bin/killall soffice 2> /dev/null else
echo "Eroor: Could not find killall. Cannot Stop soffice." fi }
case "$1" in 'start') soffice_start ;; 'stop') soffice_stop sleep 2 ;; 'restart') soffice_stop sleep 5 soffice_start ;; *) if [ -x /usr/bin/basename ]; then
echo "usage: '/usr/bin/basename $0' start| stop| restart" else
echo "usage: $0 start|stop|restart" fi esac