Add root check
This commit is contained in:
parent
1502743b54
commit
3bba15bac8
1 changed files with 5 additions and 1 deletions
|
@ -27,15 +27,19 @@ stat_cache_file() {
|
||||||
echo "The borg backup was already executed today" && exit 0
|
echo "The borg backup was already executed today" && exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
touch "$cache_file"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = '-h' ]; then
|
if [ "$1" = '-h' ]; then
|
||||||
print_help && exit 1
|
print_help && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! "$UID" -eq 0 ]; then
|
||||||
|
echo "You have to run this as root" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
[ "$1" = '-f' ] || stat_cache_file
|
[ "$1" = '-f' ] || stat_cache_file
|
||||||
|
|
||||||
|
touch "$cache_file"
|
||||||
# Setting this so the repo does not need to be given on the command line:
|
# Setting this so the repo does not need to be given on the command line:
|
||||||
BORG_REPO=ssh://flyingscorpio@2px.info:22/~/"$(hostname)".borg
|
BORG_REPO=ssh://flyingscorpio@2px.info:22/~/"$(hostname)".borg
|
||||||
export BORG_REPO
|
export BORG_REPO
|
||||||
|
|
Loading…
Add table
Reference in a new issue