From 67187cfaf3073ab4803fb75fcc815658851da0f2 Mon Sep 17 00:00:00 2001 From: clavay Date: Wed, 20 Sep 2023 13:16:34 +0200 Subject: [PATCH] fix measurement_data_dumps location set measurement_data_dumps directory in pyscada home during the venv installation use that folder in default settings.py --- install_venv.sh | 14 +++++++------- .../project_template/project_name/settings.py-tpl | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/install_venv.sh b/install_venv.sh index 62ecd710..fb40b89a 100755 --- a/install_venv.sh +++ b/install_venv.sh @@ -27,7 +27,8 @@ fi INSTALL_ROOT=/var/www/pyscada # files will be installed here log_file_dir="/var/log/pyscada/" # log files will be here SERVER_ROOT=$INSTALL_ROOT/PyScadaServer # django project root -pyscada_venv=/home/pyscada/.venv +pyscada_home=/home/pyscada +pyscada_venv=$pyscada_home/.venv # VAR answer_date="" # Is the date correct @@ -419,6 +420,7 @@ with open("./tests/project_template_tmp/project_name/settings.py-tpl", "r+") as "db_user": "${answer_db_user}", "db_password": "${answer_db_password}", "project_root": "${INSTALL_ROOT}", + "pyscada_home": "${pyscada_home}", "log_file_dir": "${log_file_dir}", "project_admins": "${project_admins}", "auto_add_apps": "${answer_auto_add_apps}", @@ -444,14 +446,12 @@ function user_setup(){ # Create pyscada user echo "Creating system user pyscada..." useradd -r pyscada - mkdir -p /home/pyscada - chown -R pyscada:pyscada /home/pyscada - mkdir -p $INSTALL_ROOT/http/measurement_data_dumps - chown -R pyscada:pyscada $INSTALL_ROOT + mkdir -p $pyscada_home + chown -R pyscada:pyscada $pyscada_home mkdir -p $INSTALL_ROOT chown -R pyscada:pyscada $INSTALL_ROOT - mkdir -p $INSTALL_ROOT/http/measurement_data_dumps - chown -R pyscada:pyscada $INSTALL_ROOT/http/measurement_data_dumps + mkdir -p $pyscada_home/measurement_data_dumps + chown -R pyscada:pyscada $pyscada_home/measurement_data_dumps mkdir ${log_file_dir} chown pyscada:pyscada ${log_file_dir} diff --git a/tests/project_template/project_name/settings.py-tpl b/tests/project_template/project_name/settings.py-tpl index d24bc460..12775ca9 100644 --- a/tests/project_template/project_name/settings.py-tpl +++ b/tests/project_template/project_name/settings.py-tpl @@ -208,7 +208,7 @@ PYSCADA_META = { # file_prefix prefix of the output files (PREFIXmeasurement_data_Y_m_d_HM.[h5,csv]) PYSCADA_EXPORT = { - 'output_folder': '{{ project_root }}/http/measurement_data_dumps', + 'output_folder': '{{ pyscada_home }}/measurement_data_dumps', 'file_prefix': PYSCADA_META['name'] + '_' }