a little better logging marks

This commit is contained in:
brent s 2017-09-01 19:30:28 -04:00
parent f3c2045d8d
commit a1925e1053

View File

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



if __name__ == '__main__': if __name__ == '__main__':
main() main()