From 5c0695a3e6e6c72de98e54394ac6f74c561f5243 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sun, 30 Sep 2018 19:49:56 -0600 Subject: [PATCH] If no root permissions, exit and display error on console, no logging. --- backup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backup.sh b/backup.sh index bebc248..3b8f02a 100755 --- a/backup.sh +++ b/backup.sh @@ -142,7 +142,6 @@ warningExplain=() ### Error codes -errorExplain[2]="This script MUST be run as ROOT." errorExplain[100]="Could not put NextCloud into Maintenance mode." ### Warning codes & messages @@ -196,9 +195,10 @@ while getopts ':l:nv5:r:' PARAMS; do done -### Verify script running as root, otherwise exit +### Verify script running as root, otherwise display error on console and exit if [ $(id -u) -ne 0 ]; then - quit 2 + echo -e "${red}This script MUST be run as ROOT. Exiting.${normal}" + exit 2 fi