summaryrefslogtreecommitdiff
path: root/bin/backup-clean
diff options
context:
space:
mode:
Diffstat (limited to 'bin/backup-clean')
-rwxr-xr-xbin/backup-clean9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/backup-clean b/bin/backup-clean
index 054ffbc..d12159d 100755
--- a/bin/backup-clean
+++ b/bin/backup-clean
@@ -26,7 +26,7 @@ date2ts() {
t=$r; r=${t#??}; M=${t%$r} # Minute
S=${t#??} # Second
date -d "$Y-$m-$d $H:$M:$S" +%s
- #date -jf "%Y-%m-%d %H:%M:%S" "$Y-$m-$d $H:$M:$S" +%s # BSD, MacOSX
+ #date -jf "%Y-%m-%d %H:%M:%S" "$Y-$m-$d $H:$M:$S" +%s # BSD, MacOS (not tested)
}
ts2date() { date -d "@$1" +'%Y%m%d_%H%M%S'; }
@@ -53,17 +53,18 @@ retention_delay() {
echo $r
}
-while getopts :nv opt; do
+dest=/.history
+while getopts :nd:v opt; do
case $opt in
+ (d) dest=$OPTARG ;;
(n) optn=1 ;;
(v) optv=1 ;;
- (*) echo "Usage: $0 [-nv] [dir]"; exit 1;
+ (*) echo "Usage: $0 [-nv] [-d dir]"; exit 1;
esac
done
shift $((OPTIND - 1))
# Sorted list of backups, most recent first.
-dest=${1:-/.history}
lbu=$(ls -rv "$dest")
for d in $lbu; do
tsc=$(date2ts "$d")