Start and stop Bitbucket
This page describes the various ways you can start or stop Bitbucket Data Center and Server, 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
To start/stop Bitbucket
Change to your
<Bitbucket Server installation directory>, then use the command that meets your needs:
For automated starting and stopping of Bitbucket Server on Windows, it should be installed as a service.
You can use
start-bitbucket.bat for short term debugging, using Ctrl+C will safely shutdown the instance when it is no longer needed.
To start/stop Bitbucket Server manually when running as a service on Windows
Start and stop the Bitbucket Server service from the services console, on Windows. Ensure you start both the
Use the app icons in the
<Bitbucket Server installation directory>. These link to the
stop-bitbucket.sh scripts in
<Bitbucket Server installation directory>/bin.
Start Bitbucket Data Center
For Bitbucket Data Center, the remote Elasticsearch instance must be started separately. It is a requirement of the Bitbucket Data Center setup that you have only one remote Elasticsearch instance for your entire cluster, as described on Installing Bitbucket Data Center. To start (or restart) a remote Elasticsearch instance, see Elasticsearch documentation for specific instructions.
To start Bitbucket Data Center (does not start Bitbucket's bundled Elasticsearch instance)
- Change to your
<Bitbucket Server installation directory>
Run this command:
Start/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.
To start/stop Bitbucket manually when running as service:
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 bitbucket status # systemctl bitbucket stop # systemctl bitbucket start
Start Bitbucket without starting bundled Elasticsearch
You're running Bitbucket Data Center: It is a requirement of the Bitbucket Data Center setup that you have only one remote Elasticsearch instance for your cluster, as described on Installing Bitbucket Data Center.
You have a remote Elasticsearch instance (for whatever reason): When using a remote Elasticsearch instance, you have to start Bitbucket without starting the bundled Elasticsearch instance.
You can also refer to How to Install and configure a remote Elasticsearch instance.
You have a Docker deployment: We strongly recommend that you run Elasticsearch on a separate container. Otherwise, you won't be able to properly trigger a graceful shutdown.
To start Bitbucket without starting the bundled Elasticsearch instance
For Docker installations, use the
-e ELASTICSEARCH_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
service atlbitbucket stop command, and
command all use the
systemctl bitbucket stop
SIGTERM signal to terminate Bitbucket.
During a graceful shutdown:
- Tomcat stops accepting new HTTP connections without interrupting active connections.
- The SSH server stop 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 config properties control how graceful shutdown works:
The amount of time (in seconds) that Bitbucket should allocate before terminating all active HTTP requests, SSH requests, and running jobs.
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
In addition to these config properties, the
BITBUCKET_SHUTDOWN_TIMEOUT environment variable controls when Bitbucket terminates altogether. This environmental variable will override
BITBUCKET_SHUTDOWN_TIMEOUT is set to 40. We recommend you keep this environmental variable at least 10 seconds longer than
Gracefully shutting down Docker deployments
If Bitbucket and ElasticSearch are running in the same container, you won't be able to trigger a graceful shutdown properly. We strongly recommend that you run ElasticSearch on its own separate container.
If ElasticSearch 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.
Was this helpful?Yes Provide feedback about this article