check if running as root

This commit is contained in:
Michael Schnerring
2020-09-08 23:00:35 +02:00
parent 0dc4614b3a
commit 4a8d44e6a8

6
disk-burnin.sh Normal file → Executable file
View File

@@ -140,6 +140,12 @@ for dependency in ${DEPENDENCIES}; do
fi
done
# Check if running as root
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root. Exiting ..."
exit 2
fi
# Check script arguments
if [ $# -ne 1 ]; then
echo "Error: not enough arguments!"