1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-22 02:17:26 +00:00

after creating the local encrypted backup, execute the after-backup script if the user has provided one to copy the files to a remote location

This commit is contained in:
Joshua Tauberer 2014-08-02 14:16:08 +00:00
parent 6d4fab1e6a
commit 6a512042dc

View File

@ -108,3 +108,12 @@ for fn in os.listdir(backup_encrypted_dir):
fn2 = os.path.join(backup_duplicity_dir, fn.replace(".enc", "")) fn2 = os.path.join(backup_duplicity_dir, fn.replace(".enc", ""))
if os.path.exists(fn2): continue if os.path.exists(fn2): continue
os.unlink(os.path.join(backup_encrypted_dir, fn)) os.unlink(os.path.join(backup_encrypted_dir, fn))
# Execute a post-backup script that does the copying to a remote server.
# Run as the STORAGE_USER user, not as root. Pass our settings in
# environment variables so the script has access to STORAGE_ROOT.
post_script = os.path.join(backup_dir, 'after-backup')
if os.path.exists(post_script):
shell('check_call',
['su', env['STORAGE_USER'], '-c', post_script],
env=env)