Start and stop Bitbucket

This page describes the various ways you can start or stop Bitbucket Data Center, depending on which method suits your needs.

Start Bitbucket during installation

The Bitbucket installer can automatically start Bitbucket. If you're not using the installer, use the instructions below that are appropriate for your needs to start Bitbucket.

On this page



Start and stop Bitbucket

To start and stop Bitbucket

For Linux

Change to your <Bitbucket installation directory>, then use the command that meets your needs:

bin/start-bitbucket.sh
bin/stop-bitbucket.sh

For macOS

Use the app icons in the <Bitbucket installation directory>. These link to the start-bitbucket.sh and stop-bitbucket.sh scripts in <Bitbucket installation directory>/bin.

Which app icons?

Start and stop app icons:

Start Bitbucket Data Center

For Bitbucket Data Center, the remote search server must be started separately. It is a requirement of the Bitbucket Data Center setup that you have only one remote search server for your entire cluster, as described on Installing Bitbucket Data Center. To start (or restart) a remote search server, see the search server documentation for specific instructions.

To start Bitbucket Data Center (does not start Bitbucket bundled search server)

  1. Change to your <Bitbucket installation directory>
  2. Run this command:

    start-bitbucket.sh --no-search


Start and stop Bitbucket when running as a service

On Windows and Linux systems, you can choose to have Bitbucket installed as a service, and it will be started automatically when the system boots.

For Linux

Manage the Bitbucket service with these commands:

# service atlbitbucket status 
# service atlbitbucket stop 
# service atlbitbucket start

If you installed Bitbucket as a systemd service (as explained in Run Bitbucket as a Linux service), use these commands instead:

# systemctl status atlbitbucket 
# systemctl stop atlbitbucket 
# systemctl start atlbitbucket 

Start Bitbucket without starting the bundled search server

Why would I want to start Bitbucket without starting the bundled search server?

You're running Bitbucket Data Center: It is a requirement of the Bitbucket Data Center setup that you have only one remote search server for your cluster, as described on Installing Bitbucket Data Center.

You have a remote search server (for whatever reason): When using a remote search server, you have to start Bitbucket without starting the bundled search server.

You can also refer to Install and configure a remote Elasticsearch server and Install and configure a remote OpenSearch server.

You have a Docker deployment: We strongly recommend that you run a search server on a separate container. Otherwise, you won't be able to properly trigger a graceful shutdown.

To start Bitbucket without starting the bundled search server:

For Linux
start-bitbucket.sh --no-search


For Docker installations, use the -e SEARCH_ENABLED=false parameter.  Learn more about deploying Bitbucket through Docker


Performing a graceful shutdown (Linux only)

You can send a SIGTERM signal to Bitbucket to trigger a graceful shutdown. This will give Bitbucket some time to complete any running tasks, in-flight GIT requests, and in-flight user requests before terminating. The bin/stop-bitbucket.sh script, service atlbitbucket stop command, and systemctl stop atlbitbucket command all use the SIGTERM signal to terminate Bitbucket. 

During a graceful shutdown:

  • Tomcat stops accepting new HTTP connections without interrupting active connections.
  • The SSH server stops accepting new SSH connections without interrupting active connections.
  • The job scheduler will not start any new jobs, but will not immediately cancel any running jobs.


The following configuration properties control how graceful shutdown works:

Default valueDescription
graceful.shutdown.timeout
30

The amount of time (in seconds) that Bitbucket should allocate before terminating all active HTTP requests, SSH requests, and running jobs.

server.shutdown
graceful

Sets whether Bitbucket should initiate a graceful shutdown first upon termination. If you want Bitbucket

to shut down immediately without waiting for any tasks to complete, set this to immediate.

In addition to these config properties, the BITBUCKET_SHUTDOWN_TIMEOUT environment variable controls when  Bitbucket terminates altogether. This environmental variable will override plugin.search.indexing.event.shutdown.timeout.

By default,  BITBUCKET_SHUTDOWN_TIMEOUT is set to 40. We recommend you keep this environmental variable at least 10 seconds longer than plugin.search.indexing.event.shutdown.timeout.

Gracefully shutting down Docker deployments

If Bitbucket and the search server are running in the same container, you won't be able to trigger a graceful shutdown properly. We strongly recommend that you run the search server on its own separate container.

If the search server is not running on the same container, you can trigger a graceful Bitbucket shutdown through docker stop. This command will send a SIGTERM signal to Bitbucket.

Last modified on Sep 24, 2024

Was this helpful?

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