Skip to content

Commit

Permalink
Merge pull request jamorham#31 from tzachi-dar/tzachi_2022_11_11_Test
Browse files Browse the repository at this point in the history
Make the python server friendly with the menu program.
  • Loading branch information
Navid200 authored Nov 15, 2022
2 parents 2851571 + 2021fc8 commit ab398a8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
25 changes: 20 additions & 5 deletions ConfigServer/run_server_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
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

4 changes: 1 addition & 3 deletions varserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ab398a8

Please sign in to comment.