a little better logging marks

This commit is contained in:
brent s 2017-09-01 19:30:28 -04:00
parent f3c2045d8d
commit a1925e1053
1 changed files with 7 additions and 0 deletions

View File

@ -148,6 +148,8 @@ def syncDB():
'--delete',
os.path.join(sks['destdir'], '.'),
sks['rsync']]
with open(sks['logfile'], 'a') as f:
f.write('===== {0} Rsyncing to mirror =====\n'.format(str(datetime.datetime.utcnow())))
with open(sks['logfile'], 'a') as f:
subprocess.run(cmd, stdout = f, stderr = f)
return()
@ -155,9 +157,14 @@ def syncDB():
def main():
if getpass.getuser() not in ('root', sks['user']):
exit('ERROR: You must be root or {0}!'.format(sks['user']))
with open(sks['logfile'], 'a') as f:
f.write('===== {0} STARTING ====='.format(str(datetime.datetime.utcnow())))
dumpDB()
compressDB()
syncDB()
with open(sks['logfile'], 'a') as f:
f.write('===== {0} DONE ====='.format(str(datetime.datetime.utcnow())))


if __name__ == '__main__':
main()