mirror of
https://github.com/bashclub/bashclub-zfs-push-pull.git
synced 2024-12-25 06:00:13 +01:00
add quiet mode
This commit is contained in:
parent
c6a82a7ccd
commit
c7dc56255e
@ -2,10 +2,11 @@
|
|||||||
# backup-zfs: use zfs send/recv to push/pull snapshots
|
# backup-zfs: use zfs send/recv to push/pull snapshots
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "$(basename "$0") [-hv] [-t tag] [-k keep] [-f dateformat] [srchost:]srcfs [desthost:]destfs" >&2
|
echo "$(basename "$0") [-hvq] [-t tag] [-k keep] [-f dateformat] [srchost:]srcfs [desthost:]destfs" >&2
|
||||||
echo "$(basename "$0"): use zfs send/recv to push/pull snapshots" >&2
|
echo "$(basename "$0"): use zfs send/recv to push/pull snapshots" >&2
|
||||||
printf "%15s: %s\n" >&2 "-h" "this help statement" \
|
printf "%15s: %s\n" >&2 "-h" "this help statement" \
|
||||||
"-v" "verbose" \
|
"-v" "verbose" \
|
||||||
|
"-q" "quiet" \
|
||||||
"-t tag" "tag to use for naming snapshots and in syslog" \
|
"-t tag" "tag to use for naming snapshots and in syslog" \
|
||||||
"-k keep" "number of snapshots to keep on src" \
|
"-k keep" "number of snapshots to keep on src" \
|
||||||
"-f dateformat" "format string for date(1), used in naming snapshots"
|
"-f dateformat" "format string for date(1), used in naming snapshots"
|
||||||
@ -16,7 +17,7 @@ usage() {
|
|||||||
# usage: log msg
|
# usage: log msg
|
||||||
log() {
|
log() {
|
||||||
logger -t $tag -- "$@"
|
logger -t $tag -- "$@"
|
||||||
if [[ -t 1 ]] || $verbose ; then
|
if ! $quiet && [[ -t 1 ]] || $verbose ; then
|
||||||
echo "$@" >&2
|
echo "$@" >&2
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -55,14 +56,16 @@ tag=backup-zfs
|
|||||||
dateformat="%F_%T"
|
dateformat="%F_%T"
|
||||||
keep=5
|
keep=5
|
||||||
verbose=false
|
verbose=false
|
||||||
|
quiet=false
|
||||||
|
|
||||||
###
|
###
|
||||||
### parse options
|
### parse options
|
||||||
###
|
###
|
||||||
while getopts "hvk:t:f:" opt ; do
|
while getopts "hvqk:t:f:" opt ; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h) usage 0 ;;
|
h) usage 0 ;;
|
||||||
v) verbose=true ;;
|
v) verbose=true ;;
|
||||||
|
q) quiet=true ;;
|
||||||
k) keep=$OPTARG ;;
|
k) keep=$OPTARG ;;
|
||||||
t) tag=$OPTARG ;;
|
t) tag=$OPTARG ;;
|
||||||
f) dateformat=$OPTARG ;;
|
f) dateformat=$OPTARG ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user