mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Showing full path of postgres backup.
This commit is contained in:
parent
386861a479
commit
d8f1081935
1 changed files with 7 additions and 4 deletions
|
@ -32,11 +32,14 @@ import time
|
|||
import boto3
|
||||
from django.conf import settings
|
||||
|
||||
BACKUP_DIR = '/srv/newsblur/backup/'
|
||||
|
||||
s3 = boto3.client('s3', aws_access_key_id=settings.S3_ACCESS_KEY, aws_secret_access_key=settings.S3_SECRET)
|
||||
|
||||
hostname = socket.gethostname().replace('-','_')
|
||||
s3_object_name = f'backup_{hostname}/backup_{hostname}_{time.strftime("%Y-%m-%d-%H-%M")}.sql'
|
||||
path = os.listdir('/srv/newsblur/backup/')[0]
|
||||
print('Uploading %s to %s on S3 bucket %s' % (path, s3_object_name, settings.S3_BACKUP_BUCKET))
|
||||
s3.upload_file(path, settings.S3_BACKUP_BUCKET, s3_object_name, Callback=ProgressPercentage(path))
|
||||
|
||||
path = os.listdir(BACKUP_DIR)[0]
|
||||
full_path = os.path.join(BACKUP_DIR, path)
|
||||
print('Uploading %s to %s on S3 bucket %s' % (full_path, s3_object_name, settings.S3_BACKUP_BUCKET))
|
||||
s3.upload_file(full_path, settings.S3_BACKUP_BUCKET, s3_object_name, Callback=ProgressPercentage(path))
|
||||
os.remove(full_path)
|
||||
|
|
Loading…
Add table
Reference in a new issue