0

I have tomcat8 intalled on my Amazon Linux AMI, I modified the tomcat8 init script header, so chkconfig could install tomcat8 to run automatically on boot. The modified header is:

#!/bin/bash
#
# tomcat      This shell script takes care of starting and stopping Tomcat
#
# chkconfig: 345 80 20
# description: Release implementation for Servlet 3.0 and JSP 2.2

### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Description: Release implementation for Servlet 3.0 and JSP 2.2
# Short-Description: start and stop tomcat
### END INIT INFO
#
# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
# - heavily rewritten by Deepak Bhole and Jason Corley
#

I as you can see I set it to run on runlevels 3, 4, and 5.

Then I runned:

sudo chkconfig --add tomcat8

And to my dispair after running the --list option, tomcat8 is off for all runlevels:

$ sudo chkconfig --add tomcat8
$ chkconfig --list tomcat8
tomcat8         0:off   1:off   2:off   3:off   4:off   5:off   6:off

What's going on? What am I missing? Why isn't chkconfig turning tomcat8 on on levels 3, 4 and 5?

1 Answer 1

1

The --add switch only adds a new service for management by chkconfig. If the service is already present and has a symlink in every /etc/rc[0-6].d directory that won't do anything...

To modify the runlevels in which tomcat8 should be started you didn't need to edit the init script, but simply run:

chkconfig --level 345 tomcat8 on

or alternatively after you modified the init file either use the reset switch:

chkconfig --level 0123456 reset

or first delete the existing symlinks from /etc/rc[0-6].d and then add them again:

chkconfig --del tomcat8
chkconfig --add tomcat8
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .