only stop server to dump database
This commit is contained in:
parent
3540b40bfc
commit
d23b5a4a4d
1 changed files with 13 additions and 4 deletions
|
|
@ -41,6 +41,18 @@ class ForgejoManager(backup_manager.BackupManager):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def stop_server(self):
|
||||||
|
cmd = "docker compose stop server"
|
||||||
|
try:
|
||||||
|
result = subprocess.run(
|
||||||
|
cmd, shell=True, text=True, check=True, capture_output=True
|
||||||
|
)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
self._gotify.send_subprocess_error("Failed to stop server", error=e)
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def start_database(self):
|
def start_database(self):
|
||||||
cmd = "docker compose up -d db"
|
cmd = "docker compose up -d db"
|
||||||
try:
|
try:
|
||||||
|
|
@ -81,10 +93,7 @@ def main():
|
||||||
config = read_config()
|
config = read_config()
|
||||||
os.chdir(config["common"]["BACKUP_DOCKER_DIR"])
|
os.chdir(config["common"]["BACKUP_DOCKER_DIR"])
|
||||||
backup_manager = ForgejoManager(config)
|
backup_manager = ForgejoManager(config)
|
||||||
if not backup_manager.stop_all_services():
|
if not backup_manager.stop_server():
|
||||||
exit(1)
|
|
||||||
if not backup_manager.start_database():
|
|
||||||
backup_manager.start_all_services()
|
|
||||||
exit(1)
|
exit(1)
|
||||||
if not backup_manager.dump_database():
|
if not backup_manager.dump_database():
|
||||||
backup_manager.start_all_services()
|
backup_manager.start_all_services()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue