diff --git a/http_server/change_server_address.py b/http_server/change_server_address.py index 97e091e..0ae0dd8 100644 --- a/http_server/change_server_address.py +++ b/http_server/change_server_address.py @@ -1,6 +1,7 @@ """ See https://stackoverflow.com/a/28950776/18655501 -Change all occurrences of things inside 'http://[address]:2628/api' to the actual IP address of the server. +Change all occurrences of things inside 'http://[address]:2628/api' to the actual IP address of the server, +or the command line argument. """ import socket diff --git a/termux_setup.sh b/termux_setup.sh index 8e44c8c..c8963fc 100755 --- a/termux_setup.sh +++ b/termux_setup.sh @@ -43,8 +43,9 @@ echo -e "history_size: 100\nnum_suggestions: 10\nsources:\n- /sdcard/Documents/D # Create Termux:Widget shortcuts mkdir -p ~/.shortcuts PROJECT_DIR=$(pwd) -echo -e "#!/bin/sh\ntermux-wake-lock\npython $PROJECT_DIR/server/server.py &> ~/.silverdict/server.log &" > ~/.shortcuts/silverdict_server.sh -echo -e "#!/bin/sh\ntermux-wake-lock\npython $PROJECT_DIR/http_server/http_server.py &> ~/.silverdict/http_server.log &" > ~/.shortcuts/silverdict_http_server.sh -echo -e "#!/bin/sh\ntermux-wake-lock\npython $PROJECT_DIR/server/server.py &> ~/.silverdict/server.log &\npython $PROJECT_DIR/http_server/http_server.py &> ~/.silverdict/http_server.log &" > ~/.shortcuts/silverdict_all.sh +echo -e "#!/bin/sh\ntermux-wake-lock\npython $PROJECT_DIR/server/server.py &> ~/.silverdict/server.log &" > ~/.shortcuts/SilverDict-Server.sh +echo -e "#!/bin/sh\ntermux-wake-lock\ncd $PROJECT_DIR/http_server\npython change_server_address.py\npython http_server.py &> ~/.silverdict/http_server.log &" > ~/.shortcuts/SilverDict-HTTP.sh +echo -e "#!/bin/sh\nkillall -SIGTERM python\ntermux-wake-unlock\nexit" > ~/.shortcuts/SilverDict-Stop.sh +chmod +x ~/.shortcuts/* # Release the lock upon logout echo "#!/bin/sh\ntermux-wake-unlock" >> ~/.bash_logout \ No newline at end of file