old_contents: #!/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()
  
new_contents: #!/usr/bin/env python
  
  from datetime import datetime
  import os.path
  import sys
  
  
  def weekday_abbrev():
      return datetime.now().strftime('%a').lower()
  
  def warn(txt):
      print >> sys.stderr, "WARNING: %s!" % txt
      os.system("""echo "At %s: %s" | mail -s "WARNING: %s" euccastro@gmail.com""" % (datetime.now(), txt, txt))
  
  def backup():
      wda = weekday_abbrev()
      backup_path = "/opt/datomic-free-0.9.5372/bak/%s" % wda
      retcode = os.system("/opt/datomic-free-0.9.5372/bin/datomic -Xmx800m -Xms800m backup-db datomic:free://localhost:4334/relembra file:%s"
                          % backup_path)
      if retcode != 0:
          warn("Couldn't backup")
          return
      retcode = os.system("/usr/bin/rclone --checksum %s acd:relembra-backup-%s" % wda)
      if retcode != 0:
          warn("Couldn't upload backup")
  
  
  if __name__ == '__main__':
      backup()
  
subject: make backup script try and upload, warn on errors