From dd49378678454977c37b0bd1c9cd04ecf8920934 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Fri, 26 Jul 2019 03:14:12 -0600 Subject: [PATCH] check running as root --- seafileBackup/seafbackup.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/seafileBackup/seafbackup.sh b/seafileBackup/seafbackup.sh index 05fdb84..7d045f1 100755 --- a/seafileBackup/seafbackup.sh +++ b/seafileBackup/seafbackup.sh @@ -388,6 +388,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 # does the details file exist? if [ ! -f "$configDetails" ]; then badParam dne "(--details default)" "$configDetails"