Starting and Stopping Confluence with the Apache Commons Daemon (JSVC)

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

 

The Apache Commons Daemon is an open-source framework for starting Java applications as a service, kind of like Linux's systemd. It's not needed most of the time, but let's say you wanted to remove the shutdown port from Tomcat for security reasons. How do you gracefully shut down Confluence without a shutdown port? You could use the Commons Daemon to start and stop Confluence in that case.
It turns out that Tomcat comes with Commons Daemon support right out of the box, with only a small amount of setup required:

Step 1: Locate the Commons Daemon source code

If you are using the version of Tomcat that came bundled with Confluence, you will need to grab the Commons Daemon source tarball. If you are using standalone Tomcat, it should be included in bin/commons-daemon-native.tar.gz.

Step 2: Build JSVC

Expand the tarball and build JSVC according to the instructions here. Be sure to set it as executable:

chmod u+x jsvc

And then copy it to the bin folder of your Tomcat install (Confluence install/bin for bundled Tomcat)

Step 3: Launch Confluence

You will need to set the environment variable TOMCAT_USER to your service login username before launching the daemon.


Execute the bin/daemon.sh script to start or stop Tomcat, and thus Confluence:

./daemon.sh start
./daemon.sh stop

The daemon.sh script should automatically pull in your JVM settings from bin/setenv.sh, so no additional configuration should be required.

Last modified on Aug 18, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.