Prefer python3 for web UI

This commit is contained in:
Taylor Helsper 2022-03-07 17:17:41 -06:00
parent 982598b94b
commit 38ee8b2ce6

View File

@ -3,5 +3,14 @@
if [ -f /home/bitcoin/.mynode/.www_use_python3 ]; then
exec /usr/local/bin/python3 /var/www/mynode/mynode.py
else
exec /usr/bin/python2.7 /var/www/mynode/mynode.py
# If not forcing python3, use prefer python3 unless in restart cycle
count=$(journalctl -b -u www.service | grep -c "Started myNode Web Server")
modcount=$(($count % 5))
if [ "$modcount" -eq 4 ]; then
echo "RESTART COUNT: $modcount (PYTHON2)"
exec /usr/bin/python2.7 /var/www/mynode/mynode.py
else
echo "RESTART COUNT: $modcount (PYTHON3)"
exec /usr/local/bin/python3 /var/www/mynode/mynode.py
fi
fi