mynode/rootfs/standard/usr/bin/mynode_www.sh

16 lines
586 B
Bash
Raw Normal View History

#!/bin/bash
if [ -f /home/bitcoin/.mynode/.www_use_python3 ]; then
exec /usr/local/bin/python3 /var/www/mynode/mynode.py
else
2022-03-07 23:17:41 +00:00
# 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