summaryrefslogtreecommitdiff
path: root/bin/backup
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2020-06-10 22:22:22 +0200
committerMarc Vertes <mvertes@free.fr>2020-06-10 22:22:22 +0200
commit1eaeadf7c8cdf74f1d8edf6e892e408f4d98662d (patch)
tree1821bc5a650f54760fa271e666925e63fbdc7f63 /bin/backup
parentbc43abee15ba8634fba1d279a3c8378111501960 (diff)
update
Diffstat (limited to 'bin/backup')
-rwxr-xr-xbin/backup5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/backup b/bin/backup
index cc98d63..3f1d586 100755
--- a/bin/backup
+++ b/bin/backup
@@ -1,10 +1,12 @@
#!/bin/sh
+[ "$USER" = root ] || exec sudo "$0" "$@"
+
# incremental backup using rsync(1)
die() { echo "$0: fatal: $@" >&2; exit 1; }
-[ "$(id -u)" = 0 ] || die must run as root
+#[ "$(id -u)" = 0 ] || die must run as root
while getopts :v opt; do
case $opt in
@@ -14,7 +16,6 @@ while getopts :v opt; do
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)