Skip to content
Snippets Groups Projects
Commit 9cd25889 authored by Carmelo Pellegrino's avatar Carmelo Pellegrino
Browse files

configuration check implemented

parent 3398a1b7
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,25 @@ function log() {
echo "$(date): ${*}" >>${logfile}
}
function check_config() {
local missing=()
[ -n "${DM_EXE_DIR+x}" ] || missing+=(DM_EXE_DIR)
[ -n "${DM_DATA_DIR+x}" ] || missing+=(DM_DATA_DIR)
[ -n "${PC_CONF_DIR+x}" ] || missing+=(PC_CONF_DIR)
[ -n "${DAQ_SERVER+x}" ] || missing+=(DAQ_SERVER)
[ -n "${DAQ_USER+x}" ] || missing+=(DAQ_USER)
if [ ! ${#missing} -eq 0 ]; then
zenity --error \
--title "Error (at $(date))" \
--text "The following configuration environment variables are missing:\n${missing[*]}\nPlease set them before run again this program."
return 1
fi
return 0
}
function put_lock() {
touch /tmp/pc.lock
}
......@@ -105,6 +124,7 @@ function get_run_number() {
}
# Script begins here
check_config || exit 1
test_lock || { zenity --error --text="There is another instance running of this program." --title="Error (at $(date))"; exit 1;}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment