blob: 97f66236f467c5e2f63caceb9e9f803fca3f2e82 (
plain)
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
|
diff --git a/src/zfs-auto-snapshot.sh b/src/zfs-auto-snapshot.sh
index cd88f0f..7639e4d 100644
--- a/src/zfs-auto-snapshot.sh
+++ b/src/zfs-auto-snapshot.sh
@@ -408,9 +408,7 @@ then
then
SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -o name -s name | \
grep "$opt_prefix"_"$opt_label" | \
- awk '{ print substr( $0, length($0) - 14, length($0) ) " " $0}' | \
- sort -r -k1,1 -k2,2 | \
- awk '{ print substr( $0, 17, length($0) )}') \
+ sort -t'@' -k2r,2 -k1,1) \
|| { print_log error "zfs list $?: $SNAPSHOTS_OLD"; exit 137; }
else
SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -o name -s name | \
@@ -588,10 +586,10 @@ SNAPPROP="-o com.sun:auto-snapshot-desc='$opt_event'"
DATE=$(date -u +%F-%H%M)
# The snapshot name after the @ symbol.
-SNAPNAME="${opt_prefix:+$opt_prefix$opt_sep}${opt_label:+$opt_label}-$DATE"
+SNAPNAME="${opt_prefix}_$DATE${opt_label:+$opt_sep$opt_label}"
# The expression for matching old snapshots. -YYYY-MM-DD-HHMM
-SNAPGLOB="${opt_prefix:+$opt_prefix$opt_sep}${opt_label:+$opt_label}-???????????????"
+SNAPGLOB="${opt_prefix}????????????????${opt_label:+?$opt_label}"
if [ -n "$opt_do_snapshots" ]
then
|