Changed root check failure to logged exit with code 2
This commit is contained in:
parent
af70cb2e2f
commit
82496e238a
@ -1 +1,3 @@
|
|||||||
[1m[2018-09-19 16:00:05]-- Start backup.sh execution ---
|
[1m[2018-09-19 16:00:05]-- Start backup.sh execution ---
|
||||||
|
[1m[31m[2018-09-19 16:08:48] -- [ERROR] Script exited with code 2 --[0m
|
||||||
|
[31mThis script MUST be run as ROOT.[0m
|
||||||
|
@ -56,7 +56,7 @@ errorExplain=()
|
|||||||
|
|
||||||
|
|
||||||
### Error codes
|
### Error codes
|
||||||
|
errorExplain[2]="This script MUST be run as ROOT."
|
||||||
|
|
||||||
|
|
||||||
### Process script parameters
|
### Process script parameters
|
||||||
@ -82,10 +82,9 @@ while getopts ':l:' PARAMS; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
### Verify script running as root, otherwise exit (un-logged)
|
### Verify script running as root, otherwise exit
|
||||||
if [ $(id -u) -ne 0 ]; then
|
if [ $(id -u) -ne 0 ]; then
|
||||||
echo -e "${bold}${red}This script must be run as root. Aborted.${normal}"
|
quit 2
|
||||||
exit 2
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user