From e495b65b24fbf77820806b795779caa696e046f1 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Fri, 26 Jul 2019 02:33:57 -0600 Subject: [PATCH] check for root --- .vscode/numbered-bookmarks.json | 18 +----------------- pilerBackup/pilerbackup.sh | 5 +++++ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index f0c59ff..4c08963 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -1,19 +1,3 @@ { - "bookmarks": [ - { - "fsPath": "$ROOTPATH$/pilerBackup/pilerbackup.sh", - "bookmarks": [ - -1, - 328, - 408, - -1, - -1, - -1, - -1, - -1, - -1, - 645 - ] - } - ] + "bookmarks": [] } \ No newline at end of file diff --git a/pilerBackup/pilerbackup.sh b/pilerBackup/pilerbackup.sh index 55c7c66..11bf132 100755 --- a/pilerBackup/pilerbackup.sh +++ b/pilerBackup/pilerbackup.sh @@ -322,6 +322,11 @@ done ### check pre-requisites and default values +# check if running as root, otherwise exit +if [ $( id -u ) -ne 0 ]; then + printf "\n${err}ERROR: script MUST be run as ROOT${norm}\n\n" + exit 2 +fi # find pilerexport, otherwise this is all pointless pilerExport=$( command -v pilerexport ) if [ ! "$pilerExport" ]; then