Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Bitbucket DIY backup (with postgres) fails on second execution

I followed the official documentation on the Bitbucket DIY Backup and managed to successfully run it to backup my PostgreSQL 14.3 database and the Bitbucket home. However, in a second execution the DIY script fails like this:

[ -> wait_for_bg_jobs][bb-001] ERROR: Database backup failed with status 1 (PID=25819)
[ -> unlock_bitbucket][bb-001] DEBUG: Running curl -L -s -f -u ******:****** http://localhost:7991/bitbucket/mvc/maintenance/lock?token=2ab330d0a9db44348d9c25d57e5f8d9fb102f421
[ -> cleanup_incomplete_backup][bb-001] DEBUG: Cleaning up after failed backup
[ -> main][bb-001] ERROR: Backing up Bitbucket failed
[ -> run_cleanup][bb-001] DEBUG: Running cleanup jobs...

When executing the pg_dump command alone, I see the problem: you cannot dump the database into the same directory (which already contains the first dump) a second time!

pg_dump -U bitbucketuser -h localhost --port=5432 -j 5 -Fd -d bitbucket --no-synchronized-snapshots -f /tmp/pg_dump
pg_dump: error: could not create directory "/tmp/pg_dump": File exists

My questions are now:

  1. Is there any easy option to configure the DIY backup to clean the previous dump?
  2. Why is Bitbucket still in maintenance mode after such an error!? It should get unlocked, but it's not! The Web UI keeps informing about "Performing backup - Backup is currently underway and shouldn't take long."

2 answers

If you are looking for a more automated Bitbucket backup and recovery solution you should check

We have an official app listed on the Atlassian marketplace it works both for Bitbucket Cloud and DC.

0 votes

Hi Dominik,

The DIY backup actually has a cleanup function defined in by default it just runs an rm of the dump file - if that's not working as expected you may need to change or amend the function to delete the temporary file.



Premier Support Engineer


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events