#!/usr/bin/env python

from datetime import datetime
import os.path


def weekday_abbrev():
    return datetime.utcnow().strftime('%a').lower()

def backup():
    os.system("/opt/datomic-free-0.9.5372/bin/datomic -Xmx800m -Xms800m backup-db datomic:free://localhost:4334/relembra file:/opt/datomic-free-0.9.5372/bak/%s" % weekday_abbrev())


if __name__ == '__main__':
    backup()

@@ -61,16 +61,27 @@
 os.path%0A
+import sys%0A
 %0A%0Adef we
@@ -120,11 +120,8 @@
 ime.
-utc
 now(
@@ -154,197 +154,669 @@
 def 
-backup():%0A    os.system(%22/opt/datomic-free-0.9.5372/bin/datomic -Xmx800m -Xms800m backup-db datomic:free://localhost:4334/relembra file:/opt/datomic-free-0.9.5372/bak/%25s%22 %25 weekday_abbrev()
+warn(txt):%0A    print %3E%3E sys.stderr, %22WARNING: %25s!%22 %25 txt%0A    os.system(%22%22%22echo %22At %25s: %25s%22 %7C mail -s %22WARNING: %25s%22 euccastro@gmail.com%22%22%22 %25 (datetime.now(), txt, txt))%0A%0Adef backup():%0A    wda = weekday_abbrev()%0A    backup_path = %22/opt/datomic-free-0.9.5372/bak/%25s%22 %25 wda%0A    retcode = os.system(%22/opt/datomic-free-0.9.5372/bin/datomic -Xmx800m -Xms800m backup-db datomic:free://localhost:4334/relembra file:%25s%22%0A                        %25 backup_path)%0A    if retcode != 0:%0A        warn(%22Couldn't backup%22)%0A        return%0A    retcode = os.system(%22/usr/bin/rclone --checksum %25s acd:relembra-backup-%25s%22 %25 wda)%0A    if retcode != 0:%0A        warn(%22Couldn't upload backup%22
 )%0A%0A%0A

make backup script try and upload, warn on errors