Commented in-script elevation, activated explicit root check

This commit is contained in:
Asif Bacchus 2018-09-05 17:20:38 -06:00
parent bc6badb8b1
commit d06f446fd5

View File

@ -103,19 +103,19 @@ logFile=/var/log/borgbackup.log
## Ensure script is running as root (required) otherwise, exit ## Ensure script is running as root (required) otherwise, exit
#if [ $(id -u) -ne 0 ]; then if [ $(id -u) -ne 0 ]; then
# echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] This script MUST" \ echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] This script MUST" \
# "be run as ROOT." "be run as ROOT."
# echo -e "\e[4;31mScript aborted\e[0;31m.\e[0m" echo -e "\e[4;31mScript aborted\e[0;31m.\e[0m"
# exit 1 exit 1
#fi fi
### elevate script -- used during program testing ### elevate script -- used during program testing
if [ $EUID != 0 ]; then #if [ $EUID != 0 ]; then
sudo "$0" "$scriptPath" # sudo "$0" "$scriptPath"
exit $? # exit $?
fi #fi
## Write script execution start in log file ## Write script execution start in log file