NewsBlur/utils/backups/backup_psql.py

19 lines
342 B
Python
Raw Normal View History

#!/usr/bin/python3
import os
import sys
2013-06-24 20:07:11 -07:00
NEWSBLUR_DIR = '/srv/newsblur'
sys.path.insert(0, NEWSBLUR_DIR)
import boto3
filename = os.listdir('/backup')[0]
2020-06-19 02:29:40 -04:00
print('Uploading %s to S3...' % filename)
s3 = boto3.resource('s3')
bucket = sys.argv[2]
bucket.upload_file(f'/backup/{filename}', name="postgres/%s" % filename)
os.remove(filename)