mirror of
https://github.com/bashclub/bashclub-zfs-push-pull.git
synced 2024-12-24 13:40:13 +01:00
change dateformat to more generic date options
Allow switching to UTC or any other full control of date(1)
This commit is contained in:
parent
c7dc56255e
commit
2eb6a5644e
12
backup-zfs
12
backup-zfs
@ -2,14 +2,14 @@
|
|||||||
# 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") [-hvq] [-t tag] [-k keep] [-f dateformat] [srchost:]srcfs [desthost:]destfs" >&2
|
echo "$(basename "$0") [-hvq] [-t tag] [-k keep] [-d dateopts] [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" \
|
"-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"
|
"-d dateopts" "options string for date(1), used in naming snapshots"
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ ZFS() {
|
|||||||
### defaults
|
### defaults
|
||||||
###
|
###
|
||||||
tag=backup-zfs
|
tag=backup-zfs
|
||||||
dateformat="%F_%T"
|
dateopts="+%F_%T"
|
||||||
keep=5
|
keep=5
|
||||||
verbose=false
|
verbose=false
|
||||||
quiet=false
|
quiet=false
|
||||||
@ -61,19 +61,19 @@ quiet=false
|
|||||||
###
|
###
|
||||||
### parse options
|
### parse options
|
||||||
###
|
###
|
||||||
while getopts "hvqk:t:f:" opt ; do
|
while getopts "hvqk:t:d:" opt ; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h) usage 0 ;;
|
h) usage 0 ;;
|
||||||
v) verbose=true ;;
|
v) verbose=true ;;
|
||||||
q) quiet=true ;;
|
q) quiet=true ;;
|
||||||
k) keep=$OPTARG ;;
|
k) keep=$OPTARG ;;
|
||||||
t) tag=$OPTARG ;;
|
t) tag=$OPTARG ;;
|
||||||
f) dateformat=$OPTARG ;;
|
d) dateopts=$OPTARG ;;
|
||||||
*) usage 1 ;;
|
*) usage 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
date="$(date +"$dateformat")"
|
date="$(date $dateopts)"
|
||||||
|
|
||||||
###
|
###
|
||||||
### parse src & dest host/fs info
|
### parse src & dest host/fs info
|
||||||
|
Loading…
Reference in New Issue
Block a user