Changed root check failure to logged exit with code 2

This commit is contained in:
Asif Bacchus 2018-09-19 16:09:27 -06:00
parent af70cb2e2f
commit 82496e238a
2 changed files with 5 additions and 4 deletions

View File

@ -1 +1,3 @@
[2018-09-19 16:00:05]-- Start backup.sh execution ---
[2018-09-19 16:08:48] -- [ERROR] Script exited with code 2 --
This script MUST be run as ROOT.

View File

@ -56,7 +56,7 @@ errorExplain=()
### Error codes
errorExplain[2]="This script MUST be run as ROOT."
### Process script parameters
@ -82,10 +82,9 @@ while getopts ':l:' PARAMS; do
done
### Verify script running as root, otherwise exit (un-logged)
### Verify script running as root, otherwise exit
if [ $(id -u) -ne 0 ]; then
echo -e "${bold}${red}This script must be run as root. Aborted.${normal}"
exit 2
quit 2
fi