backup.py 470 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. from .__load__ import *
  3. # 备份
  4. class Backup(object):
  5. def __init__(self):
  6. self.path = Demeter.config['admin']['online_path']
  7. def update(self):
  8. path = self.web
  9. files = File.getFiles(path)
  10. if files:
  11. for i in files:
  12. file = path + i + '/.git/'
  13. if File.exists(file):
  14. self.pull(path, i, file)
  15. def pull(self, path, name, file):
  16. path = path + name + '/'
  17. Shell.popen('cd ' + path + ' && git pull')