备份数据库

This commit is contained in:
caoqianming 2022-02-28 22:11:42 +08:00
parent f9e9041289
commit 9f56e30c80
1 changed files with 1 additions and 1 deletions

View File

@ -12,7 +12,7 @@ def backup_database():
"""
import datetime
name = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
command = '''pg_dump "user=postgres password=zcDsj2021 dbname=hberp" > /home/lighthouse/backup/hberp_{}.sql'''.format(name)
command = '''pg_dump "user=postgres password=zcDsj2021 dbname=hberp" > /home/lighthouse/backup/database/hberp_{}.sql'''.format(name)
completed = subprocess.run(command, shell=True, capture_output=True, text=True)
return completed