|
From: <di...@us...> - 2008-02-24 16:49:49
|
Revision: 575
http://safekeep.svn.sourceforge.net/safekeep/?rev=575&view=rev
Author: dimi
Date: 2008-02-24 08:49:47 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
Frank Crawford <fr...@cr...>
This adds the mode --list, and options which correspond with
rdiff-backup options, i.e.
--increments (equiv --list-increments) - the default,
--sizes (equiv --list-increment-sizes),
--changed=DATE (equiv --list-changed-since), and
--at-time=DATE (equiv --list-at-time).
It also adds an option which disables email (--noemail) as
when used interactively it isn't worth generating email messages.
Modified Paths:
--------------
safekeep/trunk/doc/safekeep.backup.txt
safekeep/trunk/doc/safekeep.txt
safekeep/trunk/safekeep
Modified: safekeep/trunk/doc/safekeep.backup.txt
===================================================================
--- safekeep/trunk/doc/safekeep.backup.txt 2008-02-24 16:42:59 UTC (rev 574)
+++ safekeep/trunk/doc/safekeep.backup.txt 2008-02-24 16:49:47 UTC (rev 575)
@@ -180,7 +180,10 @@
/backup/setup/snapshot/@device::
The path (device location) to the LVM volume to snapshot
- before the backup commences. It is recommended
+ before the backup commences. It is recommended.
+ Multiple snapshots may be specified, in which case the
+ order is important, the associated filesystems are mounted
+ in the order given.
Please note that using this feature requires that `safekeep(1)`
runs as `root` on the client.
Mandatory for a `<snapshot>` element.
Modified: safekeep/trunk/doc/safekeep.txt
===================================================================
--- safekeep/trunk/doc/safekeep.txt 2008-02-24 16:42:59 UTC (rev 574)
+++ safekeep/trunk/doc/safekeep.txt 2008-02-24 16:49:47 UTC (rev 575)
@@ -7,10 +7,12 @@
SYNOPSIS
--------
-'safekeep' --server [-q] [-v] [--force] [-c file] <clientid>*
+'safekeep' --server [-q] [-v] [--noemail] [--force] [-c file] <clientid>*
-'safekeep' --keys [-q] [-v] [-c file] [-i file] [--status] [--print] [--deploy] <clientid>*
+'safekeep' --keys [-q] [-v] [--noemail] [-c file] [-i file] [--status] [--print] [--deploy] <clientid>*
+'safekeep' --list [-q] [-v] [--noemail] [-c file] [--increments] [--parsable-output] [--sizes] [--changed=<time>] [--at-time=<time>] <clientid>*
+
'safekeep' --client
'safekeep' -h | -V
@@ -20,7 +22,8 @@
SafeKeep is a client/server backup script which enhances the
power of rdiff-backup with simple configuration and use.
-SafeKeep can work in server mode, client mode or SSH key management mode.
+SafeKeep can work in server mode, client mode, SSH key management mode
+or list mode.
In server mode, SafeKeep parses a set of configurations files which
defines a set of backup clients. For each backup client, SafeKeep
@@ -41,7 +44,10 @@
The SSH key management mode is a helper mode for deploying or verifying
the setup of the SSH authentification keys.
-In both server and keys management mode, you can restrict the operation
+In list mode, SafeKeep lists the details of existing archives. This is
+basically an interface to the relevant options for `rdiff-backup`.
+
+In server, keys management and list mode, you can restrict the operation
to a specific set of clients by listing the desired client IDs as
arguments. If no client ID is given, SafeKeep will operate over all known
clients.
@@ -61,6 +67,9 @@
--keys::
Selects the SSH key management mode
+--list::
+ Selects the list mode
+
Please note that you must always specify an operation mode. Earlier
versions used do default to `--server` mode, but that proved to work
out poorly in practice.
@@ -89,6 +98,10 @@
Increases the verbosity level. Can be specified more than
once.
+--noemail::
+ Disables the sending of email, no matter what the settings
+ within the configuration file.
+
SERVER OPTIONS
--------------
--force::
@@ -118,6 +131,37 @@
--deploy::
Deploy the authorization keys on the clients.
+LIST OPTIONS
+------------
+--increments::
+ Pass the `--list-increments` option to `rdiff-backup`, to
+ list the number and date of partial incremental backups for
+ the given or all clients. This is the default list option.
+
+--parseable-output::
+ Pass the `--parsable-output` option to `rdiff-backup` to
+ generate output in a format that is easily parsed by other
+ programs. This currently only works with the `--increments`.
+
+--sizes::
+ Pass the `--list-increment-sizes` option to `rdiff-backup`,
+ to list the total size of all increment and mirror files by
+ time for the given or all clients. Note, this may take some time.
+
+--changed=TIME::
+ Pass the `--list-changed-since` option for TIME to `rdiff-backup`,
+ to list the files changed since TIME for the given clients.
+ TIME is passed directly to `rdiff-backup`. Note, this may take
+ some time and generate considerable output. Also, unlike
+ `rdiff-backup` the is no option to select sub-directories.
+
+--at-time=TIME::
+ Pass the `--list-at-time` option for TIME to `rdiff-backup`,
+ to list the files in the archive that were present at the
+ given time for the given clients. Note, this may take some
+ time and generate considerable output. Also, unlike
+ `rdiff-backup` the is no option to select sub-directories.
+
CONFIGURATION
-------------
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2008-02-24 16:42:59 UTC (rev 574)
+++ safekeep/trunk/safekeep 2008-02-24 16:49:47 UTC (rev 575)
@@ -706,6 +706,38 @@
info('------------------------------------------------------------------')
debug('Server backup done')
+def do_list(cfgs, ids, list_type, list_date, list_parsable):
+ debug("Do server listing main loop")
+ for cfg in cfgs.itervalues():
+ id = cfg['id']
+ if ids and id not in ids: continue
+ info('------------------------------------------------------------------')
+ info('Server listing for client %s' % id)
+
+ args = ['rdiff-backup']
+
+ if list_type is 'increments':
+ args.extend(['--list-increments'])
+ elif list_type is 'sizes':
+ args.extend(['--list-increment-sizes'])
+ elif list_type is 'changed':
+ args.extend(['--list-changed-since', list_date])
+ elif list_type is 'attime':
+ args.extend(['--list-at-time', list_date])
+ else:
+ assert False, 'Unknown list type: ' + list_type
+
+ if list_parsable:
+ args.extend(['--parsable-output'])
+
+ args.extend([cfg['dir']])
+ ret = spawn(args)
+ if ret:
+ raise Exception('Failed to run rdiff-backup')
+
+ info('------------------------------------------------------------------')
+ debug('Server listing done')
+
def do_keys(cfgs, ids, identity, status, dump, deploy):
for cfg in cfgs.itervalues():
id = cfg['id']
@@ -853,10 +885,12 @@
def usage(exitcode=None):
print 'usage: %s --server [common options] [server options] <client-id>*' % (sys.argv[0])
print ' %s --keys [common options] [keys options] <client-id>*' % (sys.argv[0])
+ print ' %s --list [common options] [list options] <client-id>*' % (sys.argv[0])
print
print 'mode selection (you must pick one):'
print '--server launch in server mode'
print '--keys launch in keys management mode'
+ print '--list list previous backup status'
print
print 'common options:'
print '-c, --conf=FILE use the FILE configuration file'
@@ -864,6 +898,7 @@
print '-q, --quiet decreases the verbosity level'
print '-v, --verbose increases the verbosity level'
print '-V, --version show the version number and exit'
+ print '--noemail disables the sending of email'
print
print 'server options:'
print '--force force backup destination overwriting, dangerous!'
@@ -873,6 +908,13 @@
print '--status display the key status for the clients (default)'
print '--print display the authorization keys'
print '--deploy deploy the authorization keys'
+ print
+ print 'list options:'
+ print '--increments list number and dates of increments'
+ print '--parsable-output tailor output for parsing by other programs'
+ print '--sizes list sizes of all the increments'
+ print '--changed=time list files that have changed since time'
+ print '--at-time=time list files in the archive at given time'
if exitcode is not None: sys.exit(exitcode)
def main():
@@ -880,6 +922,9 @@
opts, args = getopt.getopt(sys.argv[1:], 'c:e:i:hs:qvV',
[ 'conf=', 'client', 'clientid=', 'deploy',
'email=', 'force', 'help', 'keys',
+ 'list', 'increments', 'sizes',
+ 'parsable-output', 'changed=', 'at-time=',
+ 'noemail',
'print', 'quiet', 'server', 'smtp=',
'status', 'verbose', 'version'])
except getopt.GetoptError:
@@ -894,6 +939,10 @@
verbosity = 0
clientid = None
force = 0
+ noemail = 0
+ list_type = None
+ list_parsable = 0
+ list_date = None
identity = None
keys_status = None
keys_print = None
@@ -921,6 +970,9 @@
elif o in ('--server', ):
if mode: usage(2)
mode = 'server'
+ elif o in ('--list', ):
+ if mode: usage(2)
+ mode = 'list'
elif o in ('--client', ):
if mode: usage(2)
mode = 'client'
@@ -929,6 +981,24 @@
mode = 'keys'
elif o in ('--force', ):
force = 1
+ elif o in ('--noemail', ):
+ noemail = 1
+ elif o in ('--increments', ):
+ if list_type: usage(2)
+ list_type = 'increments'
+ elif o in ('--sizes', ):
+ if list_type: usage(2)
+ list_type = 'sizes'
+ elif o in ('--parsable-output', ):
+ list_parsable = 1
+ elif o in ('--changed', ):
+ if list_type: usage(2)
+ list_type = 'changed'
+ list_date = a
+ elif o in ('--at-time', ):
+ if list_type: usage(2)
+ list_type = 'attime'
+ list_date = a
elif o in ('-i', ):
identity = a
elif o in ('--status', ):
@@ -951,6 +1021,9 @@
if mode is not 'keys' and (identity or keys_status or keys_print or keys_deploy):
usage(2)
+ if mode is not 'list' and (list_type or list_date or list_parsable):
+ usage(2)
+
if mode is not 'server' and (email or smtp):
usage(2)
@@ -1016,6 +1089,12 @@
is_client = False
verbosity_level = 1 + verbosity
do_server(cfgs, args, force)
+ elif mode is 'list':
+ if list_type is None:
+ list_type = 'increments'
+ is_client = False
+ verbosity_level = 2 + verbosity
+ do_list(cfgs, args, list_type, list_date, list_parsable)
elif mode is 'client':
is_client = True
verbosity_level = 3 + verbosity
@@ -1032,7 +1111,7 @@
traceback.print_exc(file=sys.stdout)
error('ERROR: %s' % ex)
- if email:
+ if email and not noemail:
send_notification(email, smtp)
if __name__ == '__main__':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|