diff --git a/ConfigServer/run_server_linux.sh b/ConfigServer/run_server_linux.sh index 975929e048e..41dd34a13b7 100755 --- a/ConfigServer/run_server_linux.sh +++ b/ConfigServer/run_server_linux.sh @@ -7,16 +7,27 @@ exit 5 fi +# This function kills the exiting server if it exists so that it will not interfeer with the port +function kill_existing_server() { + sudo ps -ef | grep python3.*3389 | grep -v grep | awk '{print $2}' | \ + while read -r pid ; do + sudo kill -9 "$pid"; + done +} + +kill_existing_server + + export SECRET_KEY=$(uuidgen) export ENV_DEBUG=False export ENV_TOKEN=$(uuidgen) export NS_CONFIG_FILE=/etc/nsconfig export SCRIPT_DIR=$( dirname -- "$0"; ) -sudo apt-get -y install python3-pip -pip install Django -pip install django-extensions Werkzeug -pip install qrcode + + +sudo apt-get -y install python3-pip >> /tmp/variables_log 2>&1 +pip install Django django-extensions Werkzeug qrcode >> /tmp/variables_log 2>&1 if test -f "/etc/free-dns.sh"; then . /etc/free-dns.sh @@ -37,4 +48,8 @@ echo "The server will run for 15 minutes, and after that will stop (if not used) echo #python3 manage.py runserver 0.0.0.0:3389 >> /tmp/variables_log 2>&1 -python3 $SCRIPT_DIR/manage.py runserver_plus 0.0.0.0:3389 --cert-file $CERT_LOCATION/cert.pem --key-file $CERT_LOCATION/privkey.pem >> /tmp/variables_log 2>&1 \ No newline at end of file +python3 $SCRIPT_DIR/manage.py runserver_plus 0.0.0.0:3389 --cert-file $CERT_LOCATION/cert.pem --key-file $CERT_LOCATION/privkey.pem >> /tmp/variables_log 2>&1 & + +echo press any key to return to the menu. The server will continue to run for 15 minutes until stoped. +read + diff --git a/varserver.sh b/varserver.sh index f97b4c7c30f..3a7286a02ba 100644 --- a/varserver.sh +++ b/varserver.sh @@ -4,6 +4,4 @@ dialog --colors --msgbox " \Zr Developed the xDrip team \Zn\n\n\ Copy the URL shown on the following page. Paste it into a web browser. You will have 15 minutes to edit your variables on that browser." 10 50 clear -sudo /xDrip/ConfigServer/run_server_linux.sh -sleep 60 - +sudo /xDrip/ConfigServer/run_server_linux.sh