forked from derekp7/snebu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnebu-client
executable file
·631 lines (544 loc) · 20.3 KB
/
snebu-client
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
#!/bin/bash
process_cmdline()
{
if [ "$1" == "backup" ]
then
target=do_backup
shift
elif [ "$1" == "restore" ]
then
target=do_restore
shift
elif [ "$1" == "validate" ]
then
target=validate
shift
elif [ "$1" == "listbackups" ]
then
target=listbackups
shift
elif [ "$1" == "help" ]
then
usage $2
else
usage
exit
fi
verbose=0
if ! args=("$(getopt -l "config:,name:,remote-client:,backup-server:,retention:,date:,force-full,changedir:,graft:,plugin:,verbose,help,sudo:" -o "c:n:r:d:fvC:h" -- "$@")")
then
usage target
exit 1
fi
eval set -- "${args[@]}"
while [ -n "$1" ]
do
case $1 in
-c|--config) configfile=$2; shift; shift;;
-n|--name) backupname=$2; shift; shift;;
--remote-client) clientname=$2; shift; shift;;
--backup-server) bksvrname=$2; shift; shift;;
-r|--retention) retention=$2; shift; shift;;
-d|--date) datestamp=$2; shift; shift;;
-f|--force-full) force_full=1; shift;;
-C|--changedir) tgtdirectory=$2; shift; shift;;
--graft) graftdir=$2; shift; shift;;
--plugin) plugin=$2; shift; shift;;
-h|--help) shift; usage $target;;
-v|--verbose) verbose=$((${verbose} + 1)); shift;;
--sudo) sudousr=$2; shift; shift;;
--) shift; break;;
esac
done
filelist=( "$@" )
# Command line variables trump environment variables, which trump config
# file vars, which trump defaults. Therefore, save cmdline vars for later.
savevars="$(declare -p backupname clientname bksvrname retention datestamp force_full tgtdirectory graftdir plugin 2>/dev/null)"
}
defaults()
{
configfile=${configfile:-~/.snebu-client.conf}
[ ! -f ${configfile} ] && configfile=/etc/snebu-client.conf
[ ! -f ${configfile} ] && configfile=/etc/snebu/snebu-client.conf
SNEBU=snebu
# Need to bring back command line vars, go get config file name override
eval "${savevars}"
# Process configuration file
[ -f "${configfile}" ] && . "${configfile}"
# Now re-process command line vars, as they trump config file.
eval "${savevars}"
# Set the name of the backup to the same as remote client, if backup name
# not specified
if [ -z "${backupname}" -a -n "${clientname}" ]
then
backupname="${clientname}"
fi
if [[ -z "${backupname}" && ( "${target}" = "do_backup" || "${target}" = "restore" ) ]]
then
backupname="$(uname -n)"
fi
# Set default retention schecdule based on date/weekday
if [ ${target} = "do_backup" ]
then
[ -z "${datestamp}" ] && datestamp=$(date +%s)
DAY_OF_WEEK=$(date -d @${datestamp} +%u)
DAY_OF_MONTH=$(date -d @${datestamp} +%d)
if [ -z "${retention}" ]
then
if [ ${DAY_OF_MONTH} = "01" ]
then
retention="monthly"
elif [ ${DAY_OF_WEEK} = "6" ]
then
retention="weekly"
else
retention="daily"
fi
fi
# Set include list
if [ ${#filelist[@]} != 0 ]
then
INCLUDE=( "${filelist[@]}" )
fi
fi
if [ -n "${bksvrname}" ]
then
SNEBU=do_rsnebu
fi
if [ -n "${clientname}" -a -z "${rmtuser}" ]
then
rmtuser="root"
fi
if [ -n "${bksvrname}" -a -z "${bkuser}" ]
then
bkuser="backup"
fi
if [ -n "${snebu_sshagent_env}" ]
then
snebu_sshagent_env=~/.ssh_backup_agent_env
fi
[ -n "${plugin}" ] && . ${plugin}
}
rsnebu()
{
lzop -d |snebu "${@}" |lzop -f
}
do_rsnebu()
{
lzop |rpcsh -h ${bksvrname} -u ${bkuser} -f rsnebu -m rsnebu -- "${@}" |lzop -d -f
}
usage()
{
if [ -z "$1" ]; then
cat <<-EOT
Usage: snebu-client [ subcommand ] [ options ]
snebu-client is the client front end for snebu. Use it to easily
back up a local or remote host, to either local a local storage
device, or to a remote backup server. Use it with one of the
following subcommands.
Sub commands are as follows:
backup [ -n backupname ] [ -d datestamp ] [ -r schedule ]
restore [ -n backupname ] [ -d datestamp ]
listbackups [ -n backupname [ -d datestamp ]] [ file_list... ]
validate [ -n backupname ] [ -d datestamp ]
help [subcommand]
EOT
elif [ "$1" = "backup" ]; then
cat <<-EOT
Usage: snebu-client backup [ -n backupname ] [ -d datestamp ] [ -r schedule ]
[ file-list ]
Initiates a system backup. By default, it will back up the local
host to a local snebu install. You can also use this command to back
up to a remote backup server, back up a remote host to either a local
snebu instalation, or back up a remote host to another remote backup
server, depending on which options are chosen.
Options:
-c, --config config_file Name of the configuration file. Default is
/etc/snebu-client.conf.
-n, --name backupname Name of the backup. Usually set to the server
name that you are backing up.
-d, --date datestamp Date stamp for this backup set. The format is in
time_t format, sames as the output of the "date
+%s" command.
-r, --retention schedule Retention schedule for this backup set. Typical
values are "daily", "weekly", "monthly", "yearly".
--remote-client hostname
Host name / IP address of remote server. Used to
backup a remote server to local host.
--backup-server hostname
Host name / IP address of backup server. Used to
backup to a remote server.
-f, --force-full Force a full backup
-C, --changedir path Changes to the given directory path before
backing up or restoring.
--graft /path/name/=/new/name/
Re-write path names beginning with "/path/name/"
to "/new/name/"
--plugin scriptname Specifies an optional plug in script. Usually
used to perform database-specific operations
(such as enabling hot backup mode) for systems
with a DB installed.
[ file-list ] List of files to backup -- overrides default
EOT
elif [ "$1" = "restore" ]; then
cat <<-EOT
Usage: snebu-client restore [ -n backupname ] [ -d datestamp ] [ file-list ]
Restores a given backup session identified by "-n" and "-d"
parameters. Use the "listbackups" subcommand to get a list of
available backup sessions.
Options:
-c, --config config_file Name of the configuration file. Default is
/etc/snebu-client.conf.
-n, --name backupname Name of the backup. Usually set to the server
name that you are backing up.
-d, --date datestamp Date stamp for this backup set. The format is in
time_t format, sames as the output of the "date
+%s" command.
-C, --changedir path Changes to the given directory path before
backing up or restoring.
--remote-client hostname
Host name / IP address of remote server. Used to
backup a remote server to local host.
--backup-server hostname
Host name / IP address of backup server. Used to
backup to a remote server.
[ file-list ] List of files to restore. Defaults to all.
EOT
elif [ "$1" = "validate" ]; then
cat <<-EOT
Usage: snebu-client validate [ -n backupname ] [ -d datestamp ] [ file-list ]
Compares the contents a given backup session identified by "-n" and "-d"
parameters, to what is on the client. Use the "listbackups" subcommand to
get a list of available
backup sessions.
Options:
-c, --config config_file Name of the configuration file. Default is
/etc/snebu-client.conf.
-n, --name backupname Name of the backup. Usually set to the server
name that you are backing up.
-d, --date datestamp Date stamp for this backup set. The format is in
time_t format, sames as the output of the "date
+%s" command.
-C, --changedir path Changes to the given directory path before
validating
--remote-client hostname
Host name / IP address of remote server. Used to
backup a remote server to local host.
--backup-server hostname
Host name / IP address of backup server. Used to
backup to a remote server.
[ file-list ] List of files to validate. Defaults to all.
EOT
elif [ "$1" = "listbackups" ]; then
cat <<-EOT
Usage: snebu-client listbackups [ -n hostname [ -d datestamp ]] [ file_list... ]
With no arguments specified, "listbackups" will return a list of all
systems that are contained in the backup catalog. Otherwise, when
specifying the -n parameter, a list of backup sets for that host is
returned.
Options:
-c, --config config_file Name of the configuration file. Default is
/etc/snebu-client.conf.
-n, --name backupname Name of the backup. Usually set to the server
name that you are backing up.
-d, --date datestamp Date stamp for this backup set. The format is in
time_t format, sames as the output of the "date
+%s" command.
EOT
fi
exit
}
main()
{
process_cmdline "$@"
defaults
if [[ -n "${bksvrname}" && ( -n "${client_keyprint}" || -n "${snebu_keyprint}" ) ]]
then
start_agent
fi
if [ -n "${clientname}" ]
then
[ "${target}" = "do_backup" ] && target=do_remote_backup
[ "${target}" = "do_restore" ] && target=do_remote_restore
[ "${target}" = "validate" ] && target=remote_validate
fi
${target} "${filelist[@]}"
}
start_agent() {
if [ -f ${snebu_sshagent_env} ]
then
. ${snebu_sshagent_env} >/dev/null 2>&1
fi
if [ -z "${SSH_AGENT_PID}" ] || ! kill -0 ${SSH_AGENT_PID} >/dev/null 2>&1
then
ssh-agent >${snebu_sshagent_env}
. ${snebu_sshagent_env}
fi
if [ -n "${snebu_keyprint}" -a -n "${snebu_sshkey}" ] && ! ssh-add -l |grep "$snebu_keyprint" >/dev/null 2>&1
then
ssh-add "${snebu_sshkey}"
fi
if [ -n "${client_keyprint}" -a -n "${client_sshkey}" ] && ! ssh-add -l |grep "$client_keyprint" >/dev/null 2>&1
then
ssh-add "${client_sshkey}"
fi
}
autoinclude() {
mount |egrep "ext[234]|btrfs|xfs" |awk '{print $3}'
}
# rpcsh -- Runs a function on a remote host
# This function pushes out a given set of variables and functions to
# another host via ssh, then runs a given function with optional arguments.
# Usage:
# rpcsh -h remote_host [ -p ssh-port ] -u remote_login -v "variable list" \
# -f "function list" -m mainfunc
#
# The "function list" is a list of shell functions to push to the remote host
# (including the main function to execute, and any functions that it calls)
# Use the "variable list" to send a group of variables to the remote host.
# Finally "mainfunc" is the name of the function (from "function list")
# to execute on the remote side. Any additional parameters specified gets
# passed along to mainfunc.
rpcsh() {
origargs=( "$@" )
declare useretvars retvars
if ! args=("$(getopt -l "rmthost:,rmthostport:,rmtlogin:,pushvars:,pushfuncs:,rmtmain:,retvars:,sudousr:" -o "h:p:u:v:f:m:Ar:s:" -- "$@")")
then
exit 1
fi
sshvars=( -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null )
eval set -- "${args[@]}"
while [ -n "$1" ]
do
case $1 in
-h|--rmthost) rmthost=$2; shift; shift;;
-p|--rmtport) sshvars=( "${sshvars[@]}" -p $2 ); shift; shift;;
-r|--retvars) useretvars=1; retvars=( $2 ); shift; shift;;
-u|--rmtlogin) rmtlogin=$2; shift; shift;;
-v|--pushvars) pushvars=$2; shift; shift;;
-f|--pushfuncs) pushfuncs=$2; shift; shift;;
-m|--rmtmain) rmtmain=$2; shift; shift;;
-s|--sudousr) sudousr=$2; shift; shift;;
-A) sshvars=( "${sshvars[@]}" -A ); shift;;
-i) sshvars=( "${sshvars[@]}" -i $2 ); shift; shift;;
--) shift; break;;
esac
done
rmtargs=( "$@" )
if [ -n "${sudousr}" ]
then
rmtmain=rpcsudo
rmtargs=( "${origargs[@]}" )
pushfuncs="${pushfuncs} rpcsudo"
rmtlogin="${sudousr}"
fi
if [ "${useretvars}" = 1 ]
then
eval $(ssh ${sshvars[@]} ${rmtlogin}@${rmthost} "
$(declare -p rmtargs 2>/dev/null)
$([ -n "$pushvars" ] && declare -p $pushvars 2>/dev/null)
$(declare -f $pushfuncs 2>/dev/null)
$rmtmain \"\${rmtargs[@]}\" >/dev/null 2>&1
for retvar in ${retvars[@]}
do
declare -p \$retvar |sed 's/^declare -a \([^=]*=\)'\''\(.*\)'\''/\1\2/;s/^declare .. //'
done
")
else
ssh ${sshvars[@]} ${rmtlogin}@${rmthost} "
$(declare -p rmtargs 2>/dev/null)
$([ -n "$pushvars" ] && declare -p $pushvars 2>/dev/null)
$(declare -f $pushfuncs 2>/dev/null)
$rmtmain \"\${rmtargs[@]}\"
"
fi
}
rpcsudo() {
declare useretvars retvars
if ! args=("$(getopt -l "rmthost:,rmthostport:,rmtlogin:,pushvars:,pushfuncs:,rmtmain:retvars:" -o "h:p:u:v:f:m:Ar:s:" -- "$@")")
then
exit 1
fi
eval set -- "${args[@]}"
while [ -n "$1" ]
do
case $1 in
-h|--rmthost) shift; shift;;
-p|--rmtport) shift; shift;;
-r|--retvars) useretvars=1; retvars=( $2 ); shift; shift;;
-u|--rmtlogin) rmtlogin=$2; shift; shift;;
-v|--pushvars) pushvars=$2; shift; shift;;
-f|--pushfuncs) pushfuncs=$2; shift; shift;;
-m|--rmtmain) rmtmain=$2; shift; shift;;
-s|--sudousr) sudousr=$2; shift; shift;;
-A) shift;;
-i) shift; shift;;
--) shift; break;;
esac
done
rmtargs=( "$@" )
if [ "${useretvars}" = 1 ]
then
eval $(sudo su - ${rmtlogin} -c "
$(declare -p rmtargs 2>/dev/null)
$([ -n "$pushvars" ] && declare -p $pushvars 2>/dev/null)
$(declare -f $pushfuncs 2>/dev/null)
$rmtmain \"\${rmtargs[@]}\" >/dev/null 2>&1
for retvar in ${retvars[@]}
do
declare -p \$retvar |sed 's/^declare -a \([^=]*=\)'\''\(.*\)'\''/\1\2/;s/^declare .. //'
done
")
else
sudo su - ${rmtlogin} -c "
$(declare -p rmtargs 2>/dev/null)
$([ -n "$pushvars" ] && declare -p $pushvars 2>/dev/null)
$(declare -f $pushfuncs 2>/dev/null)
$rmtmain \"\${rmtargs[@]}\"
"
fi
}
FINDCMD() {
# Printf's used in find commandline
FILE_PATTERN="%y\t%#m\t%D\t%i\t%u\t%U\t%g\t%G\t%s\t0\t%C@\t%T@\t%p\0"
LINK_PATTERN="%y\t%#m\t%D\t%i\t%u\t%U\t%g\t%G\t%s\t0\t%C@\t%T@\t%p\0%l\0"
# Build Find exclude commands from exclude list
for i in "${EXCLUDE[@]}"
do
findexclude=( "${findexclude[@]}" -path "$(echo "$i" |sed "s/\/$//")" -prune -o )
done
for i in "${EXCLUDEPAT[@]}"
do
findexclude=( "${findexclude[@]}" -path "$i" -o )
done
find "${INCLUDE[@]}" -xdev "${findexclude[@]}" \( -type f -o -type d \) \
-printf "${FILE_PATTERN}" -o -type l -printf "${LINK_PATTERN}"
}
make_include_tempfile()
{
## Attempt to create a secure temp file, fall back to less secure methods
## if mktemp isn't available
includetmp=$(mktemp /tmp/snebu.include.XXXXXXXXXX)
if [ -z "${includetmp}" ]
then
includetmp=/tmp/snebu.include.$RANDOM
fi
if [ -z "${includetmp}" ]
then
includetmp=/tmp/snebu.include.$$
fi
}
do_backup()
{
# Create list of files and metadata to backup, send to Snebu, and
# store received file list in tmp file.
[ -n "${graftdir}" ] && newbackupopts=( "${newbackupopts[@]}" --graft "${graftdir}" )
[ "${force_full}" = 1 ] && newbackupopts=( "${newbackupopts[@]}" --full )
for i in $(seq 1 "${verbose}"); do submitfilesopts=( "${submitfilesopts[@]}" -v ); done
for i in $(seq 1 "${verbose}"); do newbackupopts=( "${newbackupopts[@]}" -v ); done
# Call autoinclude function if INCLUDE is not set
[ ${#INCLUDE[@]} = 0 ] && INCLUDE=( $(autoinclude) )
while :
do
[ -n "${pluginpre}" ] && $pluginpre
make_include_tempfile
FINDCMD |$SNEBU newbackup --name ${backupname} --retention ${retention} \
--datestamp ${datestamp} --null --not-null-output "${newbackupopts[@]}" |\
cat >${includetmp}
# Now create a tar file and send it to Snebu
tar --one-file-system --no-recursion --acls --selinux --xattrs -S -P -T ${includetmp} -cf - |\
$SNEBU submitfiles --name ${backupname} --datestamp ${datestamp} "${submitfilesopts[@]}"
rm -f ${includetmp}
[ -n "${pluginpost}" ] && $pluginpost
if [ "${bkrepeat}" != 1 ]
then
break
fi
done
}
do_remote_backup()
{
# Create list of files and metadata to backup, send to Snebu, and
# store received file list in tmp file.
[ -n "${graftdir}" ] && newbackupopts=( "${newbackupopts[@]}" --graft "${graftdir}" )
[ "${force_full}" = 1 ] && newbackupopts=( "${newbackupopts[@]}" --full )
for i in $(seq 1 "${verbose}"); do submitfilesopts=( "${submitfilesopts[@]}" -v ); done
for i in $(seq 1 "${verbose}"); do newbackupopts=( "${newbackupopts[@]}" -v ); done
# Call autoinclude function if INCLUDE is not set
[ ${#INCLUDE[@]} = 0 ] && INCLUDE=( $(rpcsh -h ${clientname} -u "${rmtuser}" -f autoinclude -m autoinclude) )
bkrepeat=0
while :
do
## Run plugin pre function
[ -n "${pluginpre}" ] && $pluginpre
rpcsh -h ${clientname} -u "${rmtuser}" -f 'make_include_tempfile' \
-r 'includetmp' -m 'make_include_tempfile'
rpcsh -h ${clientname} -u "${rmtuser}" -f FINDCMD -v "INCLUDE EXCLUDE EXCLUDEPAT" -m FINDCMD |\
$SNEBU newbackup --name ${backupname} --retention ${retention} \
--datestamp ${datestamp} --null --not-null-output "${newbackupopts[@]}" |\
rpcsh -h ${clientname} -u "${rmtuser}" -m "cat >${includetmp}"
# Now create a tar file and send it to Snebu
rpcsh -h ${clientname} -u "${rmtuser}" -m "tar --one-file-system --no-recursion --acls --selinux --xattrs -S -P -T ${includetmp} -cf -" |\
$SNEBU submitfiles --name ${backupname} --datestamp ${datestamp} "${submitfilesopts[@]}"
rpcsh -h ${clientname} -u "${rmtuser}" -m "rm -f ${includetmp}"
## Run plugin post function
[ -n "${pluginpost}" ] && $pluginpost
## If plugin post function needs to back up addtional files, it sets bkrepeat on
if [ "${bkrepeat}" != 1 ]
then
break
fi
bkrepeat=0
done
}
do_restore()
{
[ -n "${graftdir}" ] && restoreopts=( "${restoreopts[@]}" --graft "${graftdir}" )
if [ -n "${tgtdirectory}" ]
then
tarargs=( "${tarargs[@]}" -C $tgtdirectory )
fi
$SNEBU restore --name ${backupname} --datestamp ${datestamp} "${restoreopts[@]}" "${@}" </dev/null |tar "${tarargs[@]}" --acls --selinux --xattrs -xvf -
}
do_remote_restore()
{
if [ -n "${tgtdirectory}" ]
then
tarargs=( "${tarargs[@]}" -C $tgtdirectory )
fi
$SNEBU restore --name ${backupname} --datestamp ${datestamp} "${@}" </dev/null |\
rpcsh -h ${clientname} -u "${rmtuser}" -m "tar ${tarargs[*]} --acls --selinux --xattrs -xvf -"
}
validate()
{
[ -n "${graftdir}" ] && restoreopts=( "${restoreopts[@]}" --graft "${graftdir}" )
if [ -n "${tgtdirectory}" ]
then
tarargs=( "${tarargs[@]}" -C $tgtdirectory )
fi
$SNEBU restore --name ${backupname} --datestamp ${datestamp} "${restoreopts[@]}" "${@}" </dev/null |tar "${tarargs[@]}" --acls --selinux --xattrs -df -
}
remote_validate()
{
if [ -n "${tgtdirectory}" ]
then
tarargs=( "${tarargs[@]}" -C $tgtdirectory )
fi
$SNEBU restore --name ${backupname} --datestamp ${datestamp} "${@}" </dev/null |\
rpcsh -h ${clientname} -u "${rmtuser}" -m "tar ${tarargs[*]} --acls --selinux --xattrs -df -"
}
listbackups()
{
[ -n "${backupname}" ] && sargs=( "${sargs[@]}" -n ${backupname} )
[ -n "${datestamp}" ] && sargs=( "${sargs[@]}" -d ${datestamp} )
if [ -z "${backupname}" -a "${verbose}" -ge 1 ]
then
for i in $( $SNEBU listbackups )
do
snebu listbackups -n $i
done
else
$SNEBU listbackups "${sargs[@]}" "${@}" </dev/null
fi
}
main "${@}"