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
Start and stop Bitbucket
To start and stop Bitbucket
For Linux
Change to your <Bitbucket Server installation directory>
, then use the command that meets your needs:
bin/start-bitbucket.sh
bin/stop-bitbucket.sh
For Windows
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 and 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 AtlassianBitbucket
and AtlassianBitbucketSearch
services.
For macOS
Use the app icons in the <Bitbucket Server installation directory>
. These link to the start-bitbucket.sh
and stop-bitbucket.sh
scripts in <Bitbucket Server installation directory>/bin
.
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's bundled search server)
- Change to your
<Bitbucket Server installation directory>
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
To start Bitbucket without starting the bundled search server
start-bitbucket.sh --no-search
For Windows
start-bitbucket.bat /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
command all use the systemctl stop atlbitbucket
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 value | Description |
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 |
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.