예제 #1
0
def backup_dir(options):
    """Do a project directory backup.

    Compresses a project directory and removes old backups.
    Optionally (if --recipent is specified) encrypts backup with gpg.
    """
    # ./paver backup_dir -s /home/user/projects/myproject -d ./test --name myproject
    if not options.name:
        options.name = os.path.basename(options.src)
    arc = archive.compress()
    if options.recipient:
        options.src = arc
        gpg = encrypt.gnupg()
        backup.rm_file(arc)
    backup.rm_old_files(options.dest, options.name, options.num)
예제 #2
0
def backup_dir(options):
    """Do a project directory backup.

    Compresses a project directory and removes old backups.
    Optionally (if --recipent is specified) encrypts backup with gpg.
    """
    # ./paver backup_dir -s /home/user/projects/myproject -d ./test --name myproject
    if not options.name:
        options.name = os.path.basename(options.src)
    arc = archive.compress()
    if options.recipient:
        options.src = arc
        gpg = encrypt.gnupg()
        backup.rm_file(arc)
    backup.rm_old_files(options.dest, options.name, options.num)
예제 #3
0
def backup_mysql(options):
    """Do a mysql backup.

    Dumps all databases, compresses dumps and removes old backups.
    Optionally (if --recipent is specified) encrypts backup with gpg.
    """
    # ./paver backup_mysql -u root -d ./test
    if options.test:
        options['db']=['test']
    dumps = mysql.mysqldump_all(options)
    for db, dump in dumps:
         options['src'] = dump
         options['name'] = db
         arc = archive.compress()
         backup.rm_file(dump)
         if options.recipient:
             options.src = arc
             gpg = encrypt.gnupg()
             backup.rm_file(arc)
         backup.rm_old_files(options.dest, db, options.num)
예제 #4
0
def backup_mysql(options):
    """Do a mysql backup.

    Dumps all databases, compresses dumps and removes old backups.
    Optionally (if --recipent is specified) encrypts backup with gpg.
    """
    # ./paver backup_mysql -u root -d ./test
    if options.test:
        options['db'] = ['test']
    dumps = mysql.mysqldump_all(options)
    for db, dump in dumps:
        options['src'] = dump
        options['name'] = db
        arc = archive.compress()
        backup.rm_file(dump)
        if options.recipient:
            options.src = arc
            gpg = encrypt.gnupg()
            backup.rm_file(arc)
        backup.rm_old_files(options.dest, db, options.num)