Adding additional tomcat instance using update-rc.d for Ubuntu fails

1.1k views Asked by At

My problem in short: I am unable to setup multiple instances of tomcat.

This started to happen on a new Ubuntu 16.04 setup with tomcat8. The same configuration works fine on Ubuntu 12.04 with tomcat7.

I've installed tomcat8 and tomcat8-user:

apt-get install tomcat8
apt-get install tomcat8-user

Then I create new instance of tomcat:

tomcat8-instance-create -p 8081 -c 8006 -w shutdown-test /var/lib/tomcat8-test

I copy all the necessary tomcat work and conf files and folders. Next I copy tomcat8 script for new instance:

/etc/init.d# cp tomcat8 tomcat8-test

I update the script with new data like that:

/etc/init.d# nano tomcat8-test

# file contents
NAME=tomcat8-test
DESC="Tomcat 8 Test instance"
CATALINA_HOME=/usr/share/tomcat8

And finally I try to update the new script for a service link:

/etc/init.d# update-rc.d tomcat8-test defaults 90

I got the following messages:

insserv: script tomcat8-test: service tomcat8 already provided! insserv: exiting now!
update-rc.d: error: insserv rejected the script header

Has anyone else experienced something like this?

All I managed to find myself is this:

source: [https://wiki.debian.org/LSBInitScripts/DependencyBasedBoot][1]
insserv: script X: service Y already provided!
Bug in the package with script X: The facility provided in script /etc/init.d/X uses a non-unique value. Changing it to a unique value (for example the script name without .sh ending), solves the issue.
1

There are 1 answers

0
Saulius On BEST ANSWER

It started to work after I additionally modified script inside /etc/init.d/tomcat8-test from:

### BEGIN INIT INFO
# Provides:          tomcat8
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $named
# Should-Stop:       $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start Tomcat.
# Description:       Start the Tomcat servlet engine.
### END INIT INFO

to:

### BEGIN INIT INFO
# Provides:          tomcat8-test
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $named
# Should-Stop:       $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start Tomcat.
# Description:       Start the Tomcat servlet engine.
### END INIT INFO

That's strange, that I did not needed to update that on ubuntu 12.04 with tomcat7 :). I thought that it's just a comments, but it looks like it's executing somehow.