From c9a5c8a71fe763b1f65fbdbecb0f6ae86adaa01d Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sun, 14 Oct 2018 10:00:48 -0600 Subject: [PATCH] Added check for NC data directory --- backup.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/backup.sh b/backup.sh index b2be919..c2ebb02 100755 --- a/backup.sh +++ b/backup.sh @@ -313,6 +313,24 @@ if [ "$checkResult" = "1" ]; then exit 1 fi +## Check NextCloud data directory +# Ensure NextCloud data directory is provided +if [ -z "$ncDataDir" ]; then + echo -e "\n${err}The NextCloud data directory must be specified" \ + "(-d parameter)${normal}\n" + exit 1 +# Ensure NextCloud data directory exists +elif [ -n "$ncDataDir" ]; then + checkExist fd "$ncDataDir" + checkResult="$?" + if [ "$checkResult" = "1" ]; then + # Specified NextCloud data directory could not be found + echo -e "\n${err}The provided NextCloud data directory" \ + "(-d parameter) does not exist.${normal}\n" + exit 1 + fi +fi + ### Log start of script operations echo -e "\e[1;35m${stamp}-- Start $scriptName execution ---${normal}" \