Mercurial > public > src > rhodecode
comparison pylons_app/lib/backup_manager.py @ 33:22b2234e51cd
Added removing of files from data
author | Marcin Kuzminski <marcin@python-blog.com> |
---|---|
date | Mon, 08 Mar 2010 10:25:13 +0100 |
parents | 468e226bbaa5 |
children | b4b25ece7797 |
comparison
equal
deleted
inserted
replaced
32:f93b523c0be3 | 33:22b2234e51cd |
---|---|
3 import tarfile | 3 import tarfile |
4 import os | 4 import os |
5 import datetime | 5 import datetime |
6 import sys | 6 import sys |
7 import subprocess | 7 import subprocess |
8 logging.basicConfig(level = logging.DEBUG, | 8 logging.basicConfig(level=logging.DEBUG, |
9 format = "%(asctime)s %(levelname)-5.5s %(message)s") | 9 format="%(asctime)s %(levelname)-5.5s %(message)s") |
10 | 10 |
11 class BackupManager(object): | 11 class BackupManager(object): |
12 def __init__(self): | 12 def __init__(self): |
13 self.id_rsa_path = '/home/pylons/id_rsa' | 13 self.id_rsa_path = '/home/pylons/id_rsa' |
14 self.check_id_rsa() | 14 self.check_id_rsa() |
65 '%(backup_file_path)s/%(backup_file_name)s' % params, | 65 '%(backup_file_path)s/%(backup_file_name)s' % params, |
66 'root@192.168.2.102:/backups/mercurial' % params] | 66 'root@192.168.2.102:/backups/mercurial' % params] |
67 | 67 |
68 subprocess.Popen(cmd) | 68 subprocess.Popen(cmd) |
69 logging.info('Transfered file %s to %s', self.backup_file_name, cmd[4]) | 69 logging.info('Transfered file %s to %s', self.backup_file_name, cmd[4]) |
70 | |
71 | |
72 def rm_file(self): | |
73 os.remove(self.backup_file_path) | |
74 | |
70 | 75 |
71 | 76 |
72 if __name__ == "__main__": | 77 if __name__ == "__main__": |
73 bm = BackupManager() | 78 bm = BackupManager() |
74 bm.backup_repos() | 79 bm.backup_repos() |
75 bm.transfer_files() | 80 bm.transfer_files() |
81 bm.rm_file() | |
76 | 82 |
77 | 83 |