diff --git a/utils/backup.sh b/utils/backup.sh
index 22c14062a989a6062d88524961488b4ec380c441..549393db7450092372f9571deb90872d2848f5fd 100755
--- a/utils/backup.sh
+++ b/utils/backup.sh
@@ -24,6 +24,11 @@
 
 # Dump a database with all procedures, permissions, structure and data
 
+
+if [ -z "$UTILSPATH" ]; then
+	UTILSPATH="$(realpath $(dirname $0))"
+	export UTILSPATH
+fi
 # The directory which the dump is to be stored to. Do not change it here. Use
 # the --backupdir=./my/dir/ option or an environment variable instead.
 BACKUPDIR="${BACKUPDIR:-../backup}"
@@ -58,7 +63,6 @@ backup:
 EOF
         )
 
-UTILS_PATH=`dirname "$(realpath $0)"`
 # Load settings from .config and defaults #####################################
 . $UTILS_PATH/load_settings.sh