mirror of
https://github.com/bashclub/bashclub-zfs-push-pull.git
synced 2024-11-07 21:01:58 +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
|
||||
|
||||
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
|
||||
printf "%15s: %s\n" >&2 "-h" "this help statement" \
|
||||
"-v" "verbose" \
|
||||
"-q" "quiet" \
|
||||
"-t tag" "tag to use for naming snapshots and in syslog" \
|
||||
"-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
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ ZFS() {
|
||||
### defaults
|
||||
###
|
||||
tag=backup-zfs
|
||||
dateformat="%F_%T"
|
||||
dateopts="+%F_%T"
|
||||
keep=5
|
||||
verbose=false
|
||||
quiet=false
|
||||
@ -61,19 +61,19 @@ quiet=false
|
||||
###
|
||||
### parse options
|
||||
###
|
||||
while getopts "hvqk:t:f:" opt ; do
|
||||
while getopts "hvqk:t:d:" opt ; do
|
||||
case $opt in
|
||||
h) usage 0 ;;
|
||||
v) verbose=true ;;
|
||||
q) quiet=true ;;
|
||||
k) keep=$OPTARG ;;
|
||||
t) tag=$OPTARG ;;
|
||||
f) dateformat=$OPTARG ;;
|
||||
d) dateopts=$OPTARG ;;
|
||||
*) usage 1 ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
date="$(date +"$dateformat")"
|
||||
date="$(date $dateopts)"
|
||||
|
||||
###
|
||||
### parse src & dest host/fs info
|
||||
|
Loading…
Reference in New Issue
Block a user