备份数据库
This commit is contained in:
parent
f9e9041289
commit
9f56e30c80
|
@ -12,7 +12,7 @@ def backup_database():
|
||||||
"""
|
"""
|
||||||
import datetime
|
import datetime
|
||||||
name = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
|
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)
|
completed = subprocess.run(command, shell=True, capture_output=True, text=True)
|
||||||
return completed
|
return completed
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue