Example #1
0
def ssh_keys():
    """
    Backup SSH keys found at ~/.ssh/ and store tar.bz2 backup to
    ~/backups/ssh-keys/ folder. File name will be something like:
    ssh-keys-20110328.tar.bz2
    """
    backup = BackupPy('ssh-keys', '%Y%m%d')
    backup.add_files('~/.ssh')
    backup.copy_to_dir('~/backups/ssh-keys')
    backup.backup()
Example #2
0
    def test_files_without_compress(self):
        file = open('%s/test.txt' % self.archive_dir, 'w')
        file.write('This is test content')
        file.close()

        backup = BackupPy('test', '%Y%m%d')
        backup.set_silent(True)
        backup.set_compress(False)
        backup.add_files('%s/test.txt' % self.archive_dir)
        backup.copy_to_dir('%s/archive-storage' % self.archive_dir)
        backup.backup()
        self.assertTrue(os.path.exists('%s/archive-storage/test-%s.tar' % (self.archive_dir, strftime('%Y%m%d'))))