summaryrefslogtreecommitdiff
path: root/bin/backup
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2020-06-09 10:06:11 +0200
committerMarc Vertes <mvertes@free.fr>2020-06-09 10:06:11 +0200
commit581ea31ab2a9f88b611080fe646d858c140ed7ca (patch)
tree6f1a0201c0e8d17bf3d83d420d82e25e4bf0f24d /bin/backup
parent1aa518b6ec9a261a83d291ff48607c2ce4c7b143 (diff)
update
Diffstat (limited to 'bin/backup')
-rwxr-xr-xbin/backup13
1 files changed, 11 insertions, 2 deletions
diff --git a/bin/backup b/bin/backup
index 2ee6b83..cc98d63 100755
--- a/bin/backup
+++ b/bin/backup
@@ -6,7 +6,16 @@ die() { echo "$0: fatal: $@" >&2; exit 1; }
[ "$(id -u)" = 0 ] || die must run as root
-dest=${1:-bip:/home/backup}/$(hostname)
+while getopts :v opt; do
+ case $opt in
+ (v) optv=v ;;
+ (*) echo "Usage: $0 [-v] [[host:]dir]"; exit 1 ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+#dest=${1:-/backup/$(hostname)}
+dest=${1:-/.history}
date=$(date +%Y%m%d_%H%M%S)
last=$(rsync --list-only $dest/ 2>/dev/null | cut -b 47- | tail -1)
@@ -15,4 +24,4 @@ case $last in
(*) opt_link=;;
esac
-rsync -DSHxav --exclude-from=/etc/backup/ignore $opt_link / /boot /home $dest/$date
+rsync -DSHxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot $dest/$date